GetPrivateProfileSection
功能:
GetPrivateProfileSection =>从指定的文件中取得全部的关键字的值
DWORD GetPrivateProfileSection(
LPCTSTR lpAppName,
LPTSTR lpReturnedString,
DWORD nSize,
LPCTSTR lpFileName);
说明:
获取指定小节所有项名和值的一个列表
返回值:
Long,装载到lpReturnedString缓冲区的字符数量。如缓冲区的容量不够大,不能容下所有信息,就返回nSize-2
参数类型及说明:
lpAppName String,欲获取的小节。注意这个字串不区分大小写
lpReturnedString String,项和值字串的列表。每个字串都由一个NULL字符分隔,最后一个字串后面用两个NULL字符中止
nSize Long,lpReturnedString缓冲区的大小。在windows系统中最大值为32767
lpFileName String,初始化文件的名字。如没有指定完整路径名,windows就在Windows目录中查找文件
功能:
GetPrivateProfileSection =>从指定的文件中取得全部的关键字的值
DWORD GetPrivateProfileSection(
LPCTSTR lpAppName,
LPTSTR lpReturnedString,
DWORD nSize,
LPCTSTR lpFileName);
说明:
获取指定小节所有项名和值的一个列表
返回值:
Long,装载到lpReturnedString缓冲区的字符数量。如缓冲区的容量不够大,不能容下所有信息,就返回nSize-2
参数类型及说明:
lpAppName String,欲获取的小节。注意这个字串不区分大小写
lpReturnedString String,项和值字串的列表。每个字串都由一个NULL字符分隔,最后一个字串后面用两个NULL字符中止
nSize Long,lpReturnedString缓冲区的大小。在windows系统中最大值为32767
lpFileName String,初始化文件的名字。如没有指定完整路径名,windows就在Windows目录中查找文件
测试程序
#include <windows.h>
#include <stdio.h>
#include <string.h>
#define WOM_WOMCLTMD_INI "c://nsc//dat//womcltmd.ini"
int main(void)
{
unsigned int func_rtn;
char StrBuf[1256];
char work[256];
unsigned int Count = 0;
int CountFlag = 0;
int CountPrivate = 0;
memset(StrBuf, '/0', sizeof(StrBuf));
memset(work, '/0', sizeof(work));
memcpy(work,"Can not fined",15);
func_rtn = GetPrivateProfileSection("womcltmd",
StrBuf,
1256,
WOM_WOMCLTMD_INI);
while(Count < func_rtn)
{
memset(work, '/0', sizeof(work)); /*work初期化をする*/
memcpy(work, &StrBuf[Count],strlen(&StrBuf[Count]));/**/
CountPrivate = strlen(&StrBuf[Count]) + 1;/**/
Count += CountPrivate;/**/
printf("work = %s/n", work);
}
//printf("func_rtn = %d/nwork = %s/nStrBuf = %s/n",func_rtn,work,StrBuf);
return 0;
}
功能:
GetPrivateProfileSection =>从指定的文件中取得全部的关键字的值
DWORD GetPrivateProfileSection(
LPCTSTR lpAppName,
LPTSTR lpReturnedString,
DWORD nSize,
LPCTSTR lpFileName);
说明:
获取指定小节所有项名和值的一个列表
返回值:
Long,装载到lpReturnedString缓冲区的字符数量。如缓冲区的容量不够大,不能容下所有信息,就返回nSize-2
参数类型及说明:
lpAppName String,欲获取的小节。注意这个字串不区分大小写
lpReturnedString String,项和值字串的列表。每个字串都由一个NULL字符分隔,最后一个字串后面用两个NULL字符中止
nSize Long,lpReturnedString缓冲区的大小。在windows系统中最大值为32767
lpFileName String,初始化文件的名字。如没有指定完整路径名,windows就在Windows目录中查找文件
功能:
GetPrivateProfileSection =>从指定的文件中取得全部的关键字的值
DWORD GetPrivateProfileSection(
LPCTSTR lpAppName,
LPTSTR lpReturnedString,
DWORD nSize,
LPCTSTR lpFileName);
说明:
获取指定小节所有项名和值的一个列表
返回值:
Long,装载到lpReturnedString缓冲区的字符数量。如缓冲区的容量不够大,不能容下所有信息,就返回nSize-2
参数类型及说明:
lpAppName String,欲获取的小节。注意这个字串不区分大小写
lpReturnedString String,项和值字串的列表。每个字串都由一个NULL字符分隔,最后一个字串后面用两个NULL字符中止
nSize Long,lpReturnedString缓冲区的大小。在windows系统中最大值为32767
lpFileName String,初始化文件的名字。如没有指定完整路径名,windows就在Windows目录中查找文件
测试程序
#include <windows.h>
#include <stdio.h>
#include <string.h>
#define WOM_WOMCLTMD_INI "c://nsc//dat//womcltmd.ini"
int main(void)
{
unsigned int func_rtn;
char StrBuf[1256];
char work[256];
unsigned int Count = 0;
int CountFlag = 0;
int CountPrivate = 0;
memset(StrBuf, '/0', sizeof(StrBuf));
memset(work, '/0', sizeof(work));
memcpy(work,"Can not fined",15);
func_rtn = GetPrivateProfileSection("womcltmd",
StrBuf,
1256,
WOM_WOMCLTMD_INI);
while(Count < func_rtn)
{
memset(work, '/0', sizeof(work)); /*work初期化をする*/
memcpy(work, &StrBuf[Count],strlen(&StrBuf[Count]));/**/
CountPrivate = strlen(&StrBuf[Count]) + 1;/**/
Count += CountPrivate;/**/
printf("work = %s/n", work);
}
//printf("func_rtn = %d/nwork = %s/nStrBuf = %s/n",func_rtn,work,StrBuf);
return 0;
}