putc与stdin,stdout,stderr

  • On the understanding of putc (c, stdout) of

C library function int putc (int char, FILE * stream) char parameter specifies the character (unsigned char a) is written to the specified stream stream, and the identifier of the mobile forward position.
Here is the () function declaration putc.
int putc (int char, FILE * stream)

The following statement means "specified in the file fp acquires a character": ch = putc (fp) ;
similarly, the following statement means "FILE pointer into the character ch fpout specified file": putc (ch, fpout);

In fact, stdin, stdout, stderr is this fp, but he was open with the computer system turned on by default, where 0 is stdin, representing the input stream, measured from the keyboard input, 1 for stdout, 2 representatives stderr, 1,2 default a display. printf () is actually output to stdout, the equivalent to fprintf (stdout, "****"), perror () is actually output to stderr, the equivalent of fprintf (stderr, "***")

Released nine original articles · won praise 9 · views 2952

Guess you like

Origin blog.csdn.net/Rice__/article/details/91582212