stdio.h in C
stdio.h in C
The header file named stdio.h in Standard C Library defines three variable types, a number of macros and various functions to implement input and output.
The variables are defined in stdio.h
The following lists some types of variables defined in stdio.h in Library C:
Description variable size_tThis is an unsigned integer type and the result of the sizeof keyword
FILEThis is a suitable type of object to store information for a File Stream
fpos_tThis is a type of object suitable for storing any location in a File
The macros are defined in stdio.h
The table below lists some macros defined in stdio.h in Library C:
Macro Description NULLThis macro is the value of a null pointer constant
_IOFBF, _IOLBF and _IONBFThese are macros that develop integer constant expressions with separate and appropriate values to use as the third parameter for setvbuf function
BUFSIZThis macro is an integer, which represents the size of the Buffer used by the setbuf function
EOFThis macro is a vowel number, only that has reached End-Of-File
FOPEN_MAXThis macro is an integer, representing the maximum number of files that the system can guarantee to be opened simultaneously
FILENAME_MAXThis macro is an integer, representing the longest length of an appropriate character array to store the filename as long as possible. If the implementer is unlimited, then this value should be the recommended maximum value
L_tmpnamThis macro is an integer, representing the longest length of an appropriate character array to store the longest temporary filename possible, created by the tmpnam function.
SEEK_CUR, SEEK_END, and SEEK_SETThis macro is used in the fseek function to identify different locations in a File
TMP_MAXThis macro is the maximum number of unique filenames that tmpnam can create
stderr, stdin, and stdoutThese macros are pointers to FILE types corresponding to Standard Error, Standard Input and Standard Output Stream
Functions defined in stdio.h
Here are some functions defined in stdio.h in Library C:
STD & Description1Int fclose function (FILE * stream)
Close the Stream. All Buffers are Flush (wipe or transfer to the periphery)
2Void clearerr function (FILE * stream)
Delete end-of-file and error indicator for the given Stream
3Int feof function (FILE * stream)
Check the end-of-file indicator for the given Stream
4Int ferror function (FILE * stream)
Check the error indicator for the given Stream
5Int fflush function (FILE * stream)
Flush the output buffer of a Stream
6Int fgetpos function (FILE * stream, fpos_t * pos)
Take the current location of the Stream file and burn it to pos
7Function FILE * fopen (const char * filename, const char * mode)
Open the file name pointed to the filename parameter by using the given mode mode
8Function size_t fread (void * ptr, size_t size, size_t nmemb, FILE * stream)
Read data from Stream given in array pointed by ptr
9Function FILE * freopen (const char * filename, const char * mode, FILE * stream)
Mount a new filename with the given Stream and at the same time close the old FILE in the Stream
tenInt fseek (FILE * stream, long int offset, int whence)
Set Stream's file position to the given offset. The offset parameter specifies the number of bytes to search from where the given location is
11Int fsetpos function (FILE * stream, const fpos_t * pos)
Set the file location of the stream to the given location. The pos parameter is a location provided by the fgetpos function
twelfthLong int ftell function (FILE * stream)
Returns the current file location of the given Stream
13Function size_t fwrite (const void * ptr, size_t size, size_t nmemb, FILE * stream)
Write data from the array pointed by ptr to the given Stream
14Int remove function (const char * filename)
Delete the filename given so that it is no longer accessible
15Int rename function (const char * old_filename, const char * new_filename)
Make the filename referenced, changed from old_filename to new_filename
16Void rewind function (FILE * stream)
Set the file location to the beginning of the file in the given Stream
17Function void setbuf (* stream, char * buffer FILE)
Defining how a Stream should be buffered (buffer)
18Int setvbuf function (FILE * stream, char * buffer, int mode, size_t size)
Another function to determine how a Stream should be buffered (buffer)
19Function FILE * tmpfile (void)
Create temporary files in wb + mode
20Char * tmpnam function (char * str)
Create and return a valid temporary filename (does not exist before creating)
21Int fprintf function (FILE * stream, const char * format, .)
Send formatted output to a Stream
22Function int printf (const char * format, .)
Send formatted output to a stdout
23Int sprintf function (char * str, const char * format, .)
Send formatted output to a string string
24Int vfprintf (FILE * stream, const char * format, va_list arg)
Send formatted output to a stream using a parameter list
25Int vprintf function (const char * format, va_list arg)
Send formatted output to a stdout using a parameter list
26Int vsprintf function (char * str, const char * format, va_list arg)
Send formatted output to a string string by using a parameter list
27Int fscanf function (FILE * stream, const char * format, .)
Read input that has been formatted from a Stream
28Int scanf function (const char * format, .)
Read input has been formatted from stdin
29Function int sscanf (const char * str, const char * format, .)
Read the formatted input from a string string
30Int fgetc function (FILE * stream)
Take the next character (an unsigned char) from the given Stream and increase the position indicator for that Stream
thirty firstChar * fgets (char * str, int n, FILE * stream)
Read a line from the given Stream and store it in the string pointed by str. It stops when any of the following conditions are encountered: (n-1) the character has been read, the newline character (new line) is read or caught end-of-file
32Int fputc (int char, FILE * stream)
Writing a character (an unsigned char) was determined by the char parameter to the given Stream and increased the position indicator for the Stream
33Function int fputs (const char * str, FILE * stream)
Write a string to the specified Stream (do not write null characters)
34Int getc function (FILE * stream)
Take the next character (an unsigned char) from the given Stream and increase the position indicator for that Stream
35Int getchar (void) function
Get a character (an unsigned char) from stdin
36Char * gets function (char * str)
Read a line from stdin and store it inside the string pointed by str. It stops when the end-of-file or newline character is encountered (new line) is read
37Int putc (int char, FILE * stream)
Write a character (an unsigned char) defined by the char parameter to the given Stream and increase the position indicator for that Stream
38Int putchar (int char) function
Writing a character (an unsigned char) has been defined by the char parameter to stdout
39Function int puts (const char * str)
Write a str string to stdout (do not write null characters). A newline character (new line) is appended to the output
40Int ungetc function (int char, FILE * stream)
Push the char character (an unsigned char) on the Stream given to the next character to be read
41Function void perror (const char * str)
Print a message describing the error to stderr. First, the printed string str is followed by a colon and then a space
According to Tutorialspoint
Last lesson: stddef.h in C
Next lesson: The function fclose () in C
You should read it
Maybe you are interested
How to link music streaming services to Google Maps
How to customize DLNA Media Streaming settings on Windows 10/11
Reasons why physical storage media is better than streaming
Fix TouchPad error on HP Stream 11 Laptop not working
Why Aren't Cryptocurrencies Currently Getting More Mainstream Attention?
The new Xbox Discord update allows watching live streams from the console