LPVOID怎么转cstring或者LPCTSTR
如题,我用MapViewOfFile函数返回一个LPVOID的数据,想把数据转换为cstring或者LPCTSTR 给AfxExtractSubString 第二个参数用,转换后程序在执行 AfxExtractSubString 这句的时候,程序崩溃。提示该 内存不能read,我转换的方法如下,以下三种方法都不行,lpInMapContext数据很小的时候还行,稍微大一点就不行了。
LPVOID lpInMapContext=MapViewOfFile(...);
//////////////////////////////////////////////////////////////////////////////////////////////
//CString str((char*)lpInMapContext)
//Cstring str=(LPSTR)lpInMapContext;
LPCTSTR str=(LPCTSTR)lpInMapContext;
///////////////////////////////////////////////////////////////////////////////////////////////
while (AfxExtractSubString(strTemp,str, i, '\r'))
{}
请问有其他安全的转换方法吗,等待大婶解答