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
本文解决了一个C编程中遇到的errorC2664错误,详细介绍了如何通过调整项目设置来解决参数类型不匹配的问题,并提供了一段示例代码。
685

被折叠的 条评论
为什么被折叠?



