0
我編程在Windows 7中,使用MS Visual C++ 2010寫值,得到運行時檢查錯誤
我使用,我可以訪問的錯誤代碼是這樣的API:
// iResult holds the error codes
lResult.GetCodeString()
我需要在文本文件中編寫此代碼。因此,這裏是我是如何進行的:
char buff[10];
strcpy (buff, lResult.GetCodeString());
pFile_display = fopen ("D:\\ABCD\\myfile_display.txt","a+");
fputs("\nthe error vlaue returned is ", pFile_display);
fwrite (buff, sizeof(char), sizeof(buff), pFile_display);
是否有這樣做的更好的方式,因爲我正在運行時檢查錯誤,我懷疑我錯在這裏做一些事情。
謝謝。順便說一句,「破」 – user3891236 2014-11-04 12:36:55
@ user3891236我的意思是「不工作」,「不正確」,「無功能」等。通常認爲不起作用的代碼被破壞。 – unwind 2014-11-04 12:49:06
我從你的sprintf得到了這個聲明,錯誤返回的是'°ôZ\\\\\\\\\\\\\\\\\\\\\\'列表太長' 。這裏有什麼不對? –
user3891236
2014-11-04 13:27:44