stdio h function: The stdio.h header file includes C standard library functions to perform input and output operation. It contains functions performing input and output operations on stdin, stdout and stderr as well as on file. It contains functions defined specifically for a particular data type like getchar and generic functions like printf and scanf.
List of stdio.h Library Functions
Click on function names below to see detailed description of functions.
Function | Description |
clearerr | Clears error indicators associated with a given stream. |
fclose | Closes the stream and flushes buffers associated with the given stream. |
feof | Checks the end-of-file indicator of the given stream. |
ferror | Checks the error indicator of the given stream. |
fflush | Flushes the content of the given stream. |
fgetc | Gets the next character from the given stream. |
fgetpos | Gets current position of the given stream. |
fgets | Reads a line from given stream and stores it into a character array. |
fopen | Opens a file in the given mode. |
fprintf | Writes formatted output to a stream. |
fputc | Writes a character to the given stream. |
fputs | Writes a string to the given stream excluding the null terminating character. |
fread | Reads data from the given stream and stores it into an array. |
freopen | Reopens a stream with different file or mode. |
fscanf | Read formatted data from given stream. |
fseek | Changes the position indicator of the given stream. |
fsetpos | Sets the position indicator of the given stream. |
ftell | Returns the current position of the given stream. |
fwrite | Writes data from an array to the given stream. |
getc | Gets the next character from the given stream and increments the position indicator. |
getchar | Returns a character from stdin stream. |
gets | Reads a line from stdin and stores it into given character array. |
perror | Prints an error message to stderr. |
printf | Print formatted data to stdout. |
putc | Writes a character to the given stream and increment the position indicator. |
putchar | Writes a character to stdout stream. |
puts | Writes a string to stdout stream excluding null terminating character. |
remove | Deletes a file. |
rename | Changes the name of an existing file. |
rewind | Reset the position indicator to the beginning of the file. |
scanf | Reads formatted data from stdin. |
setbuf | Sets buffer for the given stream. |
setvbuf | Sets buffer for the given stream with various buffering modes. |
sprintf | Writes formatted data to given string. |
sscanf | Reads formatted data from given string. |
tmpfile | Creates a temporary file having unique file name. |
tmpnam | Generates and unique and valid temporary filename. |
ungetc | Pushes a character back to the given stream. |
vfprintf | Writes formatted data to a stream using an argument list. |
vprintf | Print formatted data to stdout using an argument list. |
vsprintf | Writes formatted data to a string using an argument list. |
Data Types in stdio.h Library
Types | Description |
fpos_t | An object used for storing any position within a file. |
FILE | An object containing information of a file or stream. |
size_t | An unsigned integral type. |