【发布时间】:2015-08-03 12:21:54
【问题描述】:
我正在使用一个函数来读取假脱机文件并使用输出设置缓冲区。
该函数返回 OK 状态并正确设置readBytes。它还通知读取操作已到达文件末尾。
char* splFileContent = new char[3000];
ULONG readBytes;
int z = cwbOBJ_ReadSplF(splFile, splFileContent, 500, &readBytes, 0);
//z value is REACHED END OF FILE or OK if read but didn't reach the end of the file.
在尝试将 char 缓冲区转换为字符串时出现问题,我得到 "4Ä" 作为字符串值...
我通过这种方式将 char 缓冲区转换为字符串:
stringstream s;
s << splFileContent;
string bufferContent = s.str();
我做错了什么?
【问题讨论】:
-
您可以使用
string bufferContent(splFileContent, readBytes) ;转换为字符串