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就可以通過。
網上看了下,應該是內存操作出問題了,內存這個東西真複雜