16,472
社区成员
发帖
与我相关
我的任务
分享
DEBUG调试状态下:
func1:
{
CString str1,str2..../定义几个若干变量
callByfunc1(str1);
str1.GetLength(); //这里长度怎么是0? 断点跟踪几个变量,发现str1.str2.str3...里面的内容相同?是不是优化造成的。即事先没分配这么多的 //空间。用的时候在分配
}
callByfunc1(CString &str)
{
return pFileIn->Read( (LPSTR)(LPCTSTR)strSrc, pFileIn->GetLength());
//从一个文件里读取内容
}
callByfunc1(CString &str)
{
char* pBuf = new char[pFileIn->GetLength()+1];
memset(0, pBuf, pFileIn->GetLength()+1);
ret = pFileIn->Read( pBuf, pFileIn->GetLength());
str = pBuf;
delete []pBuf;
return ret;
//从一个文件里读取内容
}