1
當處理來自fwrite(因此錯誤)的計數不匹配時,處理錯誤,什麼是正確的方法?C fwrite錯誤處理
clearerr(File); //Clear the error
fflush(File); //Empty the buffer of it's contents
或者:
fflush(File); //Other way around, empty buffer first then reset
clearerr(File);
或者只是:
clearerr(File); //Contains fflush implicitly?
還是別的什麼?
根本調用'clearerr'的目的是什麼? –
清除文件上的錯誤指示符。我錯誤的印象是它也重新捲起了這個文件,但事實並非如此。 – SSight3
如果我沒有弄錯,'rewind'倒帶文件並清除eof和錯誤指示符。但我仍然不確定它會如何幫助你.. –