user-0 提问: fputs（）与fcolse（）的返回值为什么不统一？

回复:
user: user-1
content: 实现不一致，没统一 标准除了技术，也包含扯皮在里面。

user: user-2
content: fclose, _fcloseall Closes a stream (fclose) or closes all open streams (_fcloseall).  int fclose( FILE *stream );  int _fcloseall( void );  Function Required Header Compatibility  fclose <stdio.h> ANSI, Win 95, Win NT  _fcloseall <stdio.h> ANSI, Win 95, Win NT    For additional compatibility information, see Compatibility in the Introduction.  Libraries  LIBC.LIB Single thread static library, retail version  LIBCMT.LIB Multithread static library, retail version  MSVCRT.LIB Import library for MSVCRT.DLL, retail version    Return Value  fclose returns 0 if the stream is successfully closed. _fcloseall returns the total number of streams closed. Both functions return EOF to indicate an error.  Parameter  stream  Pointer to FILE structure  Remarks  The fclose function closes stream. _fcloseall closes all open streams except stdin, stdout, stderr (and, in MS-DOS®, _stdaux and _stdprn). It also closes and deletes any temporary files created by tmpfile. In both functions, all buffers associated with the stream are flushed prior to closing. System-allocated buffers are released when the stream is closed. Buffers assigned by the user with setbuf and setvbuf are not automatically released.  Example  /* FOPEN.C: This program opens files named "data"  * and "data2".It  uses fclose to close "data" and  * _fcloseall to close all remaining files.  */  #include <stdio.h>  FILE *stream, *stream2;  void main( void ) {    int numclosed;     /* Open for read (will fail if file "data" does not exist) */    if( (stream  = fopen( "data", "r" )) == NULL )       printf( "The file 'data' was not opened\n" );    else       printf( "The file 'data' was opened\n" );     /* Open for write */    if( (stream2 = fopen( "data2", "w+" )) == NULL )       printf( "The file 'data2' was not opened\n" );    else       printf( "The file 'data2' was opened\n" );     /* Close stream */    if( fclose( stream ) )       printf( "The file 'data' was not closed\n" );     /* All other files are closed: */    numclosed = _fcloseall( );    printf( "Number of files closed by _fcloseall: %u\n", numclosed ); }   Output  The file 'data' was opened The file 'data2' was opened Number of files closed by _fcloseall: 1     Stream I/O Routines  See Also   _close, _fdopen, fflush, fopen, freopen  fputs, fputws Write a string to a stream.  int fputs( const char *string, FILE *stream );  int fputws( const wchar_t *string, FILE *stream );  Function Required Header Compatibility  fputs <stdio.h> ANSI, Win 95, Win NT  fputws <stdio.h> or <wchar.h> ANSI, Win 95, Win NT    For additional compatibility information, see Compatibility in the Introduction.  Libraries  LIBC.LIB Single thread static library, retail version  LIBCMT.LIB Multithread static library, retail version  MSVCRT.LIB Import library for MSVCRT.DLL, retail version    Return Value  Each of these functions returns a nonnegative value if it is successful. On an error, fputs returns EOF, and fputws returns WEOF.  Parameters  string  Output string  stream  Pointer to FILE structure  Remarks  Each of these functions copies string to the output stream at the current position. fputws copies the wide-character argument string to stream as a multibyte-character string or a wide-character string according to whether stream is opened in text mode or binary mode, respectively. Neither function copies the terminating null character.  Generic-Text Routine Mappings  TCHAR.H Routine  _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined  _fputts fputs fputs fputws    Example  /* FPUTS.C: This program uses fputs to write  * a single line to the stdout stream.  */  #include <stdio.h>  void main( void ) {    fputs( "Hello world from fputs.\n", stdout ); }   Output  Hello world from fputs.   Stream I/O Routines  See Also   fgets, gets, puts, _putws

user: user-1
content: 标准不是什么都规定死的

user: user-0
content: 我测试过，跟输出多少个字符没关系

user: user-3
content: 引用 2 楼 lm_whales 的回复:统一呀： 0是非负数，EOF是负数 fclose（）只有两种状态：          成功：0，失败：EOF fputs()，有N+1 种状态 ： 成功输出N个数字符：N 失败：EOF  “fputs()，有N+1 种状态 ：成功输出N个数字符”  请问c标准有明确这么说吗？好像没找到这样的文字呢。

user: user-4
content: 要搞清楚函数返回的意义

user: user-1
content: 统一呀： 0是非负数，EOF是负数 fclose（）只有两种状态：          成功：0，失败：EOF fputs()，有N+1 种状态 ： 成功输出N个数字符：N 失败：EOF

user: user-5
content: 王八的屁股---规定