Windows has triggered a breakpoint in xxxxx.exe.
This may be due to a corruption of the heap, and indicates a bug in
xxxxx.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
今天晚上老是出现这个问题。
第一次是读写文件时,使用了函数 FileHelperFunc::GetLine(FILE* fp, char* pBuffer) ,然后fclose()时就出现这个错误,第二个参数传的是CString 然后再getbuffer,这样就出错,但用char*就没问题,不知道为什么,只能把路径都改成char*了。
第二次是 char*类型的变量赋值时出错,当给这个指针new了空间后,然后直接把字符串的值赋给它,就出错,如m_pStr = "error", 这样就出错,但用sprintf_s就可以通过。
网上看了下,应该是内存操作出问题了,内存这个东西真复杂