error C2664: 'GetPrivateProfileStringW' : cannot convert parameter 1 from 'const char [6]' to 'LPCWSTR'
解决方法:Project Properties > Configuration Properties > General and change the value of the Character Set property>Use Multi-Byte character set
#include <windows.h>
#include<string.h>
int _tmain(int argc, _TCHAR* argv[])
{
char aaa[111];
GetPrivateProfileString("hello","abc","nnn",aaa, sizeof(aaa)-1, ".\\hello.ini");
printf("%s\n",aaa);
getchar();
return 0;
}
hello.ini
hello.ini
[hello]
abc=hihihiqq
输出结果:
hihihiqq