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_t

This is an unsigned integer type and the result of the sizeof keyword

FILE

This is a suitable type of object to store information for a File Stream

fpos_t

This 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 NULL

This macro is the value of a null pointer constant

_IOFBF, _IOLBF and _IONBF

These are macros that develop integer constant expressions with separate and appropriate values ​​to use as the third parameter for setvbuf function

BUFSIZ

This macro is an integer, which represents the size of the Buffer used by the setbuf function

EOF

This macro is a vowel number, only that has reached End-Of-File

FOPEN_MAX

This macro is an integer, representing the maximum number of files that the system can guarantee to be opened simultaneously

FILENAME_MAX

This 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_tmpnam

This 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_SET

This macro is used in the fseek function to identify different locations in a File

TMP_MAX

This macro is the maximum number of unique filenames that tmpnam can create

stderr, stdin, and stdout

These 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 & Description1

Int fclose function (FILE * stream)

Close the Stream. All Buffers are Flush (wipe or transfer to the periphery)

2

Void clearerr function (FILE * stream)

Delete end-of-file and error indicator for the given Stream

3

Int feof function (FILE * stream)

Check the end-of-file indicator for the given Stream

4

Int ferror function (FILE * stream)

Check the error indicator for the given Stream

5

Int fflush function (FILE * stream)

Flush the output buffer of a Stream

6

Int fgetpos function (FILE * stream, fpos_t * pos)

Take the current location of the Stream file and burn it to pos

7

Function FILE * fopen (const char * filename, const char * mode)

Open the file name pointed to the filename parameter by using the given mode mode

8

Function size_t fread (void * ptr, size_t size, size_t nmemb, FILE * stream)

Read data from Stream given in array pointed by ptr

9

Function 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

ten

Int 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

11

Int 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

twelfth

Long int ftell function (FILE * stream)

Returns the current file location of the given Stream

13

Function 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

14

Int remove function (const char * filename)

Delete the filename given so that it is no longer accessible

15

Int rename function (const char * old_filename, const char * new_filename)

Make the filename referenced, changed from old_filename to new_filename

16

Void rewind function (FILE * stream)

Set the file location to the beginning of the file in the given Stream

17

Function void setbuf (* stream, char * buffer FILE)

Defining how a Stream should be buffered (buffer)

18

Int setvbuf function (FILE * stream, char * buffer, int mode, size_t size)

Another function to determine how a Stream should be buffered (buffer)

19

Function FILE * tmpfile (void)

Create temporary files in wb + mode

20

Char * tmpnam function (char * str)

Create and return a valid temporary filename (does not exist before creating)

21

Int fprintf function (FILE * stream, const char * format, .)

Send formatted output to a Stream

22

Function int printf (const char * format, .)

Send formatted output to a stdout

23

Int sprintf function (char * str, const char * format, .)

Send formatted output to a string string

24

Int vfprintf (FILE * stream, const char * format, va_list arg)

Send formatted output to a stream using a parameter list

25

Int vprintf function (const char * format, va_list arg)

Send formatted output to a stdout using a parameter list

26

Int vsprintf function (char * str, const char * format, va_list arg)

Send formatted output to a string string by using a parameter list

27

Int fscanf function (FILE * stream, const char * format, .)

Read input that has been formatted from a Stream

28

Int scanf function (const char * format, .)

Read input has been formatted from stdin

29

Function int sscanf (const char * str, const char * format, .)

Read the formatted input from a string string

30

Int fgetc function (FILE * stream)

Take the next character (an unsigned char) from the given Stream and increase the position indicator for that Stream

thirty first

Char * 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

32

Int 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

33

Function int fputs (const char * str, FILE * stream)

Write a string to the specified Stream (do not write null characters)

34

Int getc function (FILE * stream)

Take the next character (an unsigned char) from the given Stream and increase the position indicator for that Stream

35

Int getchar (void) function

Get a character (an unsigned char) from stdin

36

Char * 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

37

Int 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

38

Int putchar (int char) function

Writing a character (an unsigned char) has been defined by the char parameter to stdout

39

Function 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

40

Int ungetc function (int char, FILE * stream)

Push the char character (an unsigned char) on the Stream given to the next character to be read

41

Function 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

5 ★ | 1 Vote

May be interested

  • Check out the 'buffalo' Pokémon in Pokémon GoCheck out the 'buffalo' Pokémon in Pokémon Go
    each type of pokemon has hp, cp, ability to attack and endure differently. based on these indicators, players can determine as well as choosing the most powerful pokemon for their offensive tactics.
  • Sitting home can also locate Pokemon around, do you believe it?Sitting home can also locate Pokemon around, do you believe it?
    the tightening of the niantic developers' rules to prevent players from abusing the support tools also brings annoyance, such as those who have no conditions to move much, go away, it is hard to know. get the location of the pokemon around the area they live in
  • 5 undeniable benefits when playing Pokemon Go5 undeniable benefits when playing Pokemon Go
    get to know many new people, breathe fresh air, relieve stress, increase concentration thanks to going out for a walk .... are compelling reasons to force you to try pokemon go now .
  • Want to earn the fastest Pokécoins in Pokémon Go? So don't miss this article!Want to earn the fastest Pokécoins in Pokémon Go?  So don't miss this article!
    pokécoins in pokémon go play the role of buying items in the store. the more coins you earn, the more likely you are to buy more items. to earn pokécoins, players will have to complete certain tasks or buy real money.
  • Pokémon systems when fighting in Pokémon GoPokémon systems when fighting in Pokémon Go
    each pokémon system in pokémon go has different strengths, along with a specific weakness. this type of pokémon will have the power to attack the other pokémon, but can defeat the other pokémon. if you know the characteristics of each type, it will be easier to choose which pokémon to battle.
  • The terms you need to know when playing Pokémon GoThe terms you need to know when playing Pokémon Go
    pokémon go is the most prominent name in recent days. this game of capturing and training virtual animals has created a relatively new way of playing, as players have to constantly move to catch pokémon. during the process of joining pokémon go, you will encounter and use a lot of important terms. so what do they mean?
  • How to play Pokemon GO on Windows computersHow to play Pokemon GO on Windows computers
    recently, pokemon go has become a popular game, attracting thousands of gamers around the world. in previous posts network administrator has guided you on how to play pokemon go on android devices and ios devices. in the article below, network administrator will guide you how to play pokemon go on windows computers using bluestacks emulator software.
  • How to become a good Pokémon Go hunter?How to become a good Pokémon Go hunter?
    with a new way of playing, pokémon go has created a new phenomenon in the game village around the world. players will have to go around and find pokémon for themselves. so how to quickly catch pokémon and in large numbers?
  • Things to know to upgrade Pokémon in Pokémon GoThings to know to upgrade Pokémon in Pokémon Go
    the whirlwind pokémon go has spread its power right on the first day of its release. everyone rushed to the street to find a pokémon for themselves. therefore, in order to become a pokémon hunter, you need to master the basics of participating in pokémon go battlefield.
  • List of medals received in Pokemon GoList of medals received in Pokemon Go
    in addition to getting items when leveling up, gamers who join pokemon go also have the opportunity to receive their proud achievements.