C - Library - Stdio
C - Library - Stdio
h>
C Library - <stdio.h>
Advertisements
The stdio.h header defines three variable types, several macros, and various functions for performing input and output.
Library Variables
Following are the variable types defined in the header stdio.h −
size_t
1
This is the unsigned integral type and is the result of the sizeof keyword.
FILE
2
This is an object type suitable for storing information for a file stream.
fpos_t
3
This is an object type suitable for storing any position in a file.
Library Macros
Following are the macros defined in the header stdio.h −
NULL
1
This macro is the value of a null pointer constant.
2 These are the macros which expand to integral constant expressions with distinct values and suitable for the use as third argument to
the setvbuf function.
BUFSIZ
3
This macro is an integer, which represents the size of the buffer used by the setbuf function.
EOF
4
This macro is a negative integer, which indicates that the end-of-file has been reached.
FOPEN_MAX
5
This macro is an integer, which represents the maximum number of files that the system can guarantee to be opened simultaneously.
FILENAME_MAX
6 This macro is an integer, which represents the longest length of a char array suitable for holding the longest possible filename. If the
implementation imposes no limit, then this value should be the recommended maximum value.
L_tmpnam
7 This macro is an integer, which represents the longest length of a char array suitable for holding the longest possible temporary filename
created by the tmpnam function.
https://www.tutorialspoint.com/c_standard_library/stdio_h.htm 1/4
1/30/2018 C Library <stdio.h>
These macros are used in the fseek function to locate different positions in a file.
TMP_MAX
9
This macro is the maximum number of unique filenames that the function tmpnam can generate.
Library Functions
Following are the functions defined in the header stdio.h −
Follow the same sequence of functions for better understanding and to make use of Try it(Online compiler) option, because file created in the first
function will be used in subsequent functions.
10 Sets the file position of the stream to the given offset. The argument offset signifies the number of bytes to seek from the given whence
position.
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
13 Writes data from the array pointed to by ptr to the given stream.
https://www.tutorialspoint.com/c_standard_library/stdio_h.htm 2/4
1/30/2018 C Library <stdio.h>
FILE *tmpfile(void)
19 Creates a temporary file in binary update mode (wb+).
32 Writes a character (an unsigned char) specified by the argument char to the specified stream and advances the position indicator for the
stream.
int getchar(void)
35 Gets a character (an unsigned char) from stdin.
36 Reads a line from stdin and stores it into the string pointed to by, str. It stops when either the newline character is read or when the end-
of-file is reached, whichever comes first.
https://www.tutorialspoint.com/c_standard_library/stdio_h.htm 3/4
1/30/2018 C Library <stdio.h>
Advertisements
YouTube 38B
https://www.tutorialspoint.com/c_standard_library/stdio_h.htm 4/4