vc读取当前路径和读取配置ini文件
2014-06-04 16:41
288 查看
//获取路径 std::string GetApplicationDir() { HMODULE hModule = GetModuleHandleW(NULL); WCHAR wpath[MAX_PATH]; GetModuleFileNameW(hModule, wpath, MAX_PATH); std::wstring wide(wpath); std::string path = CefString(wide); path = path.substr( 0, path.find_last_of("\\/") ); return path; }
获取配置ini文件
//这里配置网址 2014-06-04 std::string path=GetApplicationDir(); std::string File = std::string("\\httpUrl.ini"); std::string pathFile = path+File; char strUrl[100]; int i= ::GetPrivateProfileStringA("config","url","",strUrl,100, pathFile.data()); //这里要注意 //pathFile.data()是const char*类型如果定义在外面如下: //const char* pa=pathFile.data()或const char* pa=pathFile.c_str()
相关文章推荐
- 使用GetModuleFileName()获取当前.exe所在绝对路径,并且读取.ini配置文件
- vc里读取配置文件(ini)的问题
- MFC读取和写入INI配置文件当前目录
- C++ 获取当前进程加载模块的完整路径读取配置文件
- 读取INI配置文件GetProfileString和GetPrivateProfileString参数说明和示例
- 读取ini配置文件的API
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- 用vb.net读取INI配置文件的方法,使用API
- 利用GetPrivateProfileString读取配置文件(.ini)
- 利用GetPrivateProfileString读取配置文件(.ini)
- 脚本引擎之----读取INI配置文件
- ASP.NET 2.0 读取配置文件[INI]
- 读取配置参数的properties文件,路径获取完美解决
- MFC中如何读取.ini配置文件
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- INI的替代品--XML配置文件读取与保存
- 用VC读取和分析格式化文本配置文件
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)