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:
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:
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.
Name | Description | Notes | Source | Availability | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abort_ |
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.