程序中用到fscanf、fprintf,为了判断异常,需要知道两个函数的返回值含义。
先看fscanf,参考cplusplus.com:
On success, the function returns the number of items of the argument list successfully filled. This count can match the expected number of items or be less (even zero) due to a matching failure, a reading error, or the reach of the end-of-file.
If a reading error happens or the end-of-file is reached while reading, the proper indicator is set (feof or