c语言中,成功调用fprintf fscanf函数后有什么返回值吗

2020-06-26 教育 157阅读
当然有。楼主可看MSDN有详细描述,
fscanf, fwscanf
Read formatted data from a stream.
int fscanf( FILE *stream, const char *format [, argument ]... );
int fwscanf( FILE *stream, const wchar_t *format [, argument ]... );

Return Value // 也就是正常会返回从文件成功写入的变量个数,否则返回EOF
Each of these functions returns the number of fields successfully converted and assigned; the return value does not include fields that were read but not assigned. A return value of 0 indicates that no fields were assigned. If an error occurs, or if the end of the file stream is reached before the first conversion, the return value isEOFfor fscanf orWEOFforfwscanf.

fprintf, fwprintf
Print formatted data to a stream.
intfprintf(FILE*stream,constchar*format[,argument]...);
intfwprintf(FILE*stream,constwchar_t*format[,argument]...);

Return Value // 也就是正常会返回写入文件的字节数,否则返回负数
fprintfreturns the number of bytes written.fwprintfreturns the number of wide characters written. Each of these functions returns a negative value instead when an output error occurs.
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com