请教 GetPrivateProfileSectionNames()用法(在线,解决给分!)
读取ini文件,例如:
[section1]
value1=....;
value2=....;
[section2]
value1=....;
value2=....;
我不知道[sectioni]的名称和数量。查msdn发现GetPrivateProfileSectionNames()
可以达到目的。
我的程序如下:
char section[256];
GetPrivateProfileSectionNames(
section, // return buffer
256, // size of return buffer
datafile.c_str() // initialization file name
);
但只能返回第一个section的值,
请大家帮忙!!!
[section1]
value1=....;
value2=....;
[section2]
value1=....;
value2=....;
我不知道[sectioni]的名称和数量。查msdn发现GetPrivateProfileSectionNames()
可以达到目的。
我的程序如下:
char section[256];
GetPrivateProfileSectionNames(
section, // return buffer
256, // size of return buffer
datafile.c_str() // initialization file name
);
但只能返回第一个section的值,
请大家帮忙!!!
...全文
相关推荐
c#实现ini文件读写类分享
", CharSet = CharSet.Ansi)] public static extern int GetPrivateProfileSectionNames(IntPtr lpszReturnBuffer
C++ GetPrivateProfileSectionNames的用法
GetPrivateProfileSectionNames的用法 获取配置文件(.ini)中所有的section,由于通过GetPrivateProfileSectionNames方法是将所有的section全部放在一个字符数组里面也就是strbuff中,所以要通过循环遍历将每一个section取出来,具体见代码 int nSize = GetPrivateProfileSectionNames(strBuff, 100, strFilePath); // nsize 表示读取到所有section中的字符
kernel32用于对INI文件操作
**GetPrivateProfileSectionNames**: 这个函数用于获取INI文件中所有的段名。返回的是一个字符串缓冲区,包含了每个段名。5.
如何调用API函数读写INI文件
`SetLastError = true`意味着当函数失败时,我们可以检查`Marshal.GetLastWin32Error()`获取错误信息。3.
C/C++ INI文件操作实现代码
**GetPrivateProfileSectionNames**:获取INI文件中所有的节名。参数包括接收节名的缓冲区、缓冲区大小和INI文件名。


