#include <stdio.h>int fputc(int ch, FILE *stream);

The fputc( ) function writes the character ch to the specified stream at the current file position and then advances the file position indicator. Even though ch is declared to be an int for historical reasons, it is converted by fputc( ) into an unsigned char. Because a character argument is elevated to an integer at the time of the call, you will generally see character values used as arguments. If an integer were used, the high-order byte(s) would simply be discarded.

The value returned by fputc( ) is the value of the character written. If an error occurs, EOF is returned. For files opened for binary operations, an EOF may be a valid character, and the function ferror( ) will need to be used to determine whether an error has actually occurred.

Related functions are fgetc( ), fopen( ), fprintf( ), fread( ), and fwrite( ).

C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net