"LPWSTR" 类型的值不能用于初始化 "char *" 类型的实体
void CFaceTemptureDlg::OnButtonClick_SO2()
{
// TODO: Add your command handler code here
CString strLine, strTemp, result;
int row = 0;
CString filename = L"111.txt";
CStdioFile file(L"111.txt", CFile::modeRead);
while (file.ReadString(strLine))
{
char *str = strLine.GetBufferSetLength(strLine.GetLength());
char *p;
if (strLine != "")
{
result += strLine;
GetDlgItem(IDC_Edit_SO2)->SetWindowText(result);
row++;
}
}
file.Close(); }
解决办法: 类型转换 参考知识 CString与LPCWSTR、LPSTR、char*、LPWSTR等类型的转换
char *str = strLine.GetBufferSetLength(strLine.GetLength());
改为:
char *str = (char *)strLine.GetBufferSetLength(strLine.GetLength());