Names specified here
Name Description Notes Source Availability
stderr Output stream for errors <stdio.h> C89 C90 C95 C99 C11
stdin Standard input stream <stdio.h> C89 C90 C95 C99 C11
stdout Standard output stream <stdio.h> C89 C90 C95 C99 C11

When a program starts executing, three text streams are already open for use. stdin is standard input, which by default is usually taken from the console or terminal that a program is executed in. stdout is standard output, which by default is usually directed to the console or terminal. stderr is standard error output, which by default is also usually directed to the console or terminal. All three are of type FILE *, and are declared in <stdio.h>.

Several functions read from stdin implicitly:

Functions reading from stdin
Name Description Notes Source Availability
getchar() Input character from standard input (·) <stdio.h> C89 C90 C95 C99 C11
getwchar() Input wide character from standard input (·) <wchar.h> C95 C99 C11
scanf() Input formatted text (·) <stdio.h> C89 C90 C95 C99 C11
scanf_s() Input formatted text ? (·) <stdio.h> C11
vscanf() Input formatted text (·) <stdio.h> C99 C11
vscanf_s() Input formatted text ? (·) <stdio.h> C11
vwscanf() Input formatted text (·) <wchar.h> C99 C11
vwscanf_s() Input formatted text ? (·) <wchar.h> C11
wscanf() Input formatted text (·) <wchar.h> C95 C99 C11
wscanf_s() Input formatted text ? (·) <wchar.h> C11

Several functions write to stdout implicitly:

Functions writing to stdout
Name Description Notes Source Availability
printf() Print formatted text (·) <stdio.h> C89 C90 C95 C99 C11
printf_s() Print formatted text ? (·) <stdio.h> C11
putchar() Output character to standard output (·) <stdio.h> C89 C90 C95 C99 C11
putwchar() Output wide character to standard output (·) <wchar.h> C95 C99 C11
vprintf() Print formatted text (·) <stdio.h> C89 C90 C95 C99 C11
vprintf_s() Print formatted text ? (·) <stdio.h> C11
vwprintf() Print formatted text (·) <wchar.h> C95 C99 C11
vwprintf_s() Print formatted text ? (·) <wchar.h> C11
wprintf() Print formatted text (·) <wchar.h> C95 C99 C11
wprintf_s() Print formatted text ? (·) <wchar.h> C11

The second output stream stderr allows programs to report error messages to the console even when the standard output has be redirected to another destination, such as a file or another program.

Functions writing to stderr
Name Description Notes Source Availability
abort_handler_s() Report constraint violation and abort ? (·) <stdlib.h> C11
assert() Test assertion M (·) <assert.h> C89 C90 C95 C99 C11
perror() Report last error (·) <stdio.h> C89 C90 C95 C99 C11

Initially, stdin, stdout and stderr are unoriented. You should not use wide-oriented functions on stderr, because it would then be an error to use the standard functions that use it implicitly, which are byte-oriented and pertain to error handling. It's not a good idea to have an error in your error handler.


CHaR
Sitemap Supported
Site format updated 2024-06-05T22:37:07.391+0000
Data updated 1970-01-01T00:00:00.000+0000
Page updated 2023-10-04T20:24:03.201+0000