Standard IO Library: stdio.h

I l @ ve RuBoard

Standard I/O Library: stdio.h

The ANSI C standard library includes several standard I/O functions associated with streams and the stdio.h file. Table F.12 presents the ANSI prototypes for these functions along with a brief explanation of what they do. The header file also defines the FILE type, the values EOF and NULL , and the standard I/O streams stdin , stdout , and stderr , along with several constants used by the functions in this library.

Table  F.12. ANSI C standard I/O functions.
Prototype Description
void clearerr (FILE *); Clears end-of-file and error indicators
int fclose(FILE *); Closes the indicated file
int feof(FILE *); Tests for end of file
int ferror (FILE *); Tests error indicator
int fflush (FILE *); Flushes the indicated file
int fgetc (FILE *); Gets the next character from the indicated input stream
int fgetpos (FILE *, Stores the current value fpos_t *); of the file position indicator
char * fgets(char *, Gets the next line (or int, FILE *); indicated number of characters ) from the indicated stream
FILE * fopen(const char *, const char *); Opens the indicated file
int fprintf(FILE *, const char *, ...); Writes the formatted output to the indicated stream
int fputc (int, FILE *); Writes the indicated character to the indicated stream
int fputs(const char *, FILE *); Writes the character string pointed to by the first argument to indicated stream
size_t fread(void *, size_t, size_t, FILE *); Reads binary data from the indicated stream
FILE * freopen (const char *, const char *, FILE *); Opens the indicated file and associates it with the indicated stream
int fscanf(FILE *, const char *, ...); Reads formatted input from the indicated stream
int fsetpos (FILE *, const fpos_t *); Sets the file-position pointer to the indicated value
int fseek(FILE *, long, int); Sets the file-position pointer to the indicated value
long ftell (FILE *); Gets the current file position
size_t fwrite(const void *, size_t, size_t, FILE *); Writes binary data to the indicated stream
int getc(FILE *); Reads the next character from the indicated input
int getchar (); Reads the next character from the standard input
char * gets(char *); Gets the next line from the standard input
void perror(const char *); Writes system error messages to the standard error
int printf(const char *, ...); Writes formatted output to the standard output
int putc(int, FILE *); Writes the indicated character to the indicated output
int putchar (int); Writes the indicated character to the standard output
int puts(const char *); Writes the string to the standard output
int remove(const char *); Removes the named file
int rename(const char *, constchar *); Renames the named file
void rewind(FILE *); Sets the file-position pointer to the start of the file
int scanf(const char *, ...); Reads formatted input from the standard input
void setbuf (FILE *, char *); Sets the buffer size and location
int setvbuf (FILE *, char *, int, size_t); Sets the buffer size, location, and mode
int sprintf(char *, const char *, ...); Writes formatted output to the indicated string
int sscanf (const char *, const char *, ...); Reads formatted input from the indicated string
FILE * tmpfile (void); Creates a temporary file
char * tmpnam(char *); Generates a unique name for a temporary file
int ungetc (int, FILE *); Pushes the indicated character back onto the input stream
int vfprintf(FILE *, const char *, va_list); Like fprintf(); , except uses a single list-argument of type va_list initialized by va_start instead of a variable argument list
int vprintf (const char *, va_list); Like printf(); , except uses a single list- argument of type va_list initialized by va_start instead of a variable argument list
int vsprintf(char *, const char *, va_list); Like sprintf(); , except uses a single list-argument of type va_list initialized by va_start instead of a variable argument list
I l @ ve RuBoard


C++ Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 314
Authors: Stephen Prata

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