我是 c++ 的一种新手,同时在 windows CE .net compact 应用程序上工作
在尝试将六进制数据写入文件时
CString dataBlock1;
dataBlock1 = "";
CString temp;
for(int i = 0; i < rLen; i++)
{
temp.Format(L"%02X ",rec[i]);
dataBlock1 += temp;
}
std::ofstream out(file);
在使用以下写入函数将六进制数据写入文件时,我收到此错误无法将参数 1 从 wchar * 转换为 const char*
out.write(myReader.dataBlock1.GetBuffer(),myReader.dataBlock1.GetLength());
我们如何将 wchar_* 转换为 const char* 以使 write 函数工作。
谢谢。