C Library Functions: Stream Input/Output

Formatted Input/Output

Function Header File Description
fprintf stdio.h Formats and prints characters to the output stream.
fscanf stdio.h Reads data from a stream into locations given by arguments.
fwprintf stdio.h
wchar.h
Formats and writes wide characters to the output stream.
fwscanf stdio.h
wchar.h
Reads wide characters from a stream into locations given by arguments.
printf stdio.h Formats and prints characters to stdout.
scanf stdio.h Reads data from stdin into locations given by arguments.
sprintf stdio.h Formats and writes characters to a buffer.
sscanf stdio.h Reads data from a buffer into locations given by arguments.
swprintf wchar.h Formats and writes wide characters to a buffer.
swscanf wchar.h Reads wide characters from a buffer into locations given by arguments.
vfprintf stdarg.h
stdio.h
Formats and prints characters to a file using a variable number of arguments.
vfwprintf stdarg.h
stdio.h
wchar.h
Formats and writes wide characters to a file using a variable number of arguments.
vprintf stdarg.h
stdio.h
Formats and writes characters to stdout using a variable number of arguments.
vsprintf stdarg.h
stdio.h
Formats and writes characters to a buffer using a variable number of arguments.
vswprintf stdarg.h
wchar.h
Formats and writes wide characters to a buffer using a variable number of arguments.
vwprintf stdarg.h
wchar.h
Formats and writes wide characters to stdout using a variable number of arguments.
wprintf wchar.h Formats and writes wide characters to stdout.
wscanf wchar.h Reads wide characters from a buffer into locations given by arguments.

Character and String Input/Output

Function Header File Description
fgetc stdio.h Reads a character from a specified input stream.
_fgetchar stdio.h Reads a character from the standard input stream.
fgets stdio.h Reads a string from a specified input stream.
fputc stdio.h Prints a character to a specified output stream.
_fputchar stdio.h Prints a character to the standard output stream.
fputs stdio.h Prints a string to a specified output stream.
getc stdio.h Reads a character from a specified input stream.
getchar stdio.h Reads a character from stdin.
gets stdio.h Reads a line from stdin.
putc stdio.h Prints a character to a specified output stream.
putchar stdio.h Prints a character to stdout.
puts stdio.h Prints a string to stdout.
ungetc stdio.h Pushes a character back onto a specified input stream.

Wide Character and String Input/Output

Function Header File Description
fgetwc stdio.h
wchar.h
Reads a wide character from a specified input stream.
fgetws stdio.h
wchar.h
Reads a wide string from a specified input stream.
fputwc stdio.h
wchar.h
Writes a wide character to a specified output stream.
fputws stdio.h
wchar.h
Writes a wide character string to a specified output stream.
getwc stdio.h
wchar.h
Reads a wide character from a specified input stream.
getwchar wchar.h Reads a wide character from stdin.
putwc stdio.h
wchar.h
Writes a wide character to a specified output stream.
putwchar wchar.h Writes a wide character to stdout.
ungetwc stdio.h
wchar.h
Pushes a wide character back onto a specified input stream.

Direct Input/Output

Function Header File Description
clearerr stdio.h Resets error indicators.
feof stdio.h Tests end-of-file indicator for stream input.
ferror stdio.h Tests the error indicator for a specified stream.
fread stdio.h Reads items from a specified input stream.
fwrite stdio.h Writes items to a specified output stream.

File Positioning

Function Header File Description
fgetpos stdio.h Gets the current position of the file pointer.
fseek stdio.h Moves the file pointer to a new location.
fsetpos stdio.h Moves the file pointer to a new location.
ftell stdio.h Gets the current position of the file pointer.
lseek io.h Moves a file pointer to a new location.
rewind stdio.h Repositions the file pointer to the beginning of the file.

File Access

Function Header File Description
fclose stdio.h Closes a specified stream.
_fcloseall stdio.h Closes all open streams, except the standard streams.
fdopen stdio.h Associates an input or output stream with a file.
fflush stdio.h Causes the system to write the contents of a buffer to a file.
_flushall stdio.h Writes the contents of buffers to files.
fopen stdio.h Opens a specified stream.
freopen stdio.h Closes a file and reassigns a stream.
setbuf stdio.h Allows control of buffering.
_setmode io.h Sets the translation mode of a file.
setvbuf stdio.h Controls buffering and buffer size for a specified stream.

File Operations

Function Header File Description
fileno stdio.h Determines the file handle.
remove stdio.h Deletes a specified file.
rename stdio.h Renames a specified file.
_rmtmp stdio.h Closes and deletes temporary files.
tempnam stdio.h Creates a temporary file name in another directory.
tmpfile stdio.h Creates a temporary file and returns a pointer to that file.
tmpnam stdio.h Produces a temporary file name.
umask io.h Sets the file permission mask of the executing process environment.
unlink stdio.h Deletes a file.


Alphabetical Listing of IBM C and C++ Compilers Functions and Macros