【发布时间】:2019-06-26 06:36:12
【问题描述】:
我正在尝试使用 GetPrivateProfileString 从 ini 文件中读取我的程序的身份验证详细信息。我想上directory/Folder/File.ini) 但不知道该怎么做
我试过GetFullPathName()
void ini {
std::string iniPath = "/Ice/Ice.ini";
LPWSTR inipath = A2W_EX(iniPath.c_str(), iniPath.length());
DWORD IniPath = std::strtoul(iniPath.c_str(), NULL, 16);
std::string playerUsername;
std::string playerPassword;
TCHAR iniauthChar[32];
playerUsername = GetPrivateProfileString(authheader, authuser, 0, iniauthChar, 256, inipath);
playerPassword = GetPrivateProfileString(authheader, authpass, 0, iniauthChar, 256, inipath);
}
这是我的ini文件,位于上面的目录
[AUTH]
Username=
Password=
【问题讨论】:
-
@TedLyngmo 包含文件系统并添加后
namespace fs = std::filesystem;文件系统不是std的成员 -
您是否使用
C++17语言选项进行编译?如果您使用namespace fs = std::filesystem;,则可以使用fs::path或std::filesystem::path等。 -
我不知道我在
properties->C/C++->Language下检查过,但没有看到C++ Language Standard但是我可以告诉你我正在使用SDKWindows 8.1和构建工具v140这两个东西我无法改变。 -
我对ini文件做了一些测试。我已经使用路径加载了它。它返回 NULL 作为结果