无语了, windows 中的字符转换
2016-11-07 17:15
302 查看
LPCWSTR strName = L"shuishi张三";
LPCWSTR appName = L"StudnetInfo";
//判断文件夹是否存在
int state = _access( File_Path, ABI::Windows::Devices::Custom::IOControlAccessMode::IOControlAccessMode_Any);
//Windows::Devices::Custom::
bool isFileExist;
if (state != 0)
{
//不存在这个文件夹, 需要重新创建文件夹
int dirSuccess = mkdir(File_Path);
if (dirSuccess != 0)
{
assert(false, "the dir can't create");
}
}
else
{
//直接读取即可
}
//拼接字符串
char strFile[1024];
sprintf(strFile, "%s\\%s", File_Path, File_Name);
LPCWSTR convStr = (LPCWSTR)strFile;
std::ofstream fout(strFile);
if (fout)
{
std::cout << "创建成功" << std::endl;
std::cout << File_Path << std::endl;
}
else
{
std::cout << "创建失败" << std::endl;
std::cout << File_Path << std::endl;
}
LPSTR lpStr = (LPSTR)(LPCSTR)(strFile);
LPCWSTR lpCW = A2WBSTR(lpStr);
int ptr = WritePrivateProfileString(L"StudnetInfo", L"Name", strName, lpCW);
看来还需要多学习啊, windows 中的字符及编码还是没太摸清楚
LPCWSTR appName = L"StudnetInfo";
//判断文件夹是否存在
int state = _access( File_Path, ABI::Windows::Devices::Custom::IOControlAccessMode::IOControlAccessMode_Any);
//Windows::Devices::Custom::
bool isFileExist;
if (state != 0)
{
//不存在这个文件夹, 需要重新创建文件夹
int dirSuccess = mkdir(File_Path);
if (dirSuccess != 0)
{
assert(false, "the dir can't create");
}
}
else
{
//直接读取即可
}
//拼接字符串
char strFile[1024];
sprintf(strFile, "%s\\%s", File_Path, File_Name);
LPCWSTR convStr = (LPCWSTR)strFile;
std::ofstream fout(strFile);
if (fout)
{
std::cout << "创建成功" << std::endl;
std::cout << File_Path << std::endl;
}
else
{
std::cout << "创建失败" << std::endl;
std::cout << File_Path << std::endl;
}
LPSTR lpStr = (LPSTR)(LPCSTR)(strFile);
LPCWSTR lpCW = A2WBSTR(lpStr);
int ptr = WritePrivateProfileString(L"StudnetInfo", L"Name", strName, lpCW);
看来还需要多学习啊, windows 中的字符及编码还是没太摸清楚
相关文章推荐
- Windows中的字符转换(Multibyte to Widechar&&Widechar to Multibyte)
- TrueTypeFont(2)--如何将转换为在 Windows 95 中的 TrueType 标志符号索引的 Unicode 字符代码
- 关于Windows 开发遇到的字符转换问题
- Windows上的字符转换之CP_ACP和CP_OEMCP
- 在windows下的QT编程中的char*,wchar_t*与QString之间的转换(利用reinterpret_cast和_stprintf函数,fromWCharArray从字符数组里读取数据)
- Windows中两种多字符与宽字符的转换方法
- Windows上的字符转换之CP_ACP和CP_OEMCP
- Windows WCHAR 到 Linux wchar_t 字符类型的转换
- Windows上的字符转换
- Windows WCHAR 到 Linux wchar_t 字符类型的转换
- Windows上的字符转换之CP_ACP和CP_OEMCP
- PoEdu-Windows班-002 常用字符类型及转换
- Windows中两种多字符与宽字符的转换方法
- c/c++,windows中各种字符的转换
- Windows编程菜鸟问题——宽字符与char型互相转换的问题
- windows | C/C++ | 宽字符与多字符之间的转换
- Windows编程中一些常用的字符(串)类型转换
- Windows 10 取消长路径260个字符的限制
- JS直接转换含中文的乱序字符为日期