stdin, stdout, stderr
Defined in header <stdio.h>
|
||
#define stdin /* implementation-defined */ |
(1) | |
#define stdout /* implementation-defined */ |
(2) | |
#define stderr /* implementation-defined */ |
(3) | |
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 13 HOURS 56 MINUTES 07 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 13 HOURS 56 MINUTES 06 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
These macros are expanded to expressions of type MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 13 HOURS 56 MINUTES 05 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE*.
Notes
Although not mandated by POSIX, the UNIX convention is that stdin
and stdout
are line-buffered if associated with a terminal and stderr
is unbuffered.
These macros may be expanded to modifiable lvalues. If any of these MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 13 HOURS 56 MINUTES 03 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE* lvalue is modified, subsequent operations on the corresponding stream result in unspecified or undefined behavior.
Example
This example shows a function equivalent to MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 13 HOURS 56 MINUTES 02 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE.
#include <stdarg.h> #include <stdio.h> int my_printf(const char * restrict fmt, ...) { va_list vl; va_start(vl, fmt); int ret = MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 13 HOURS 56 MINUTES 01 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE(stdout, fmt, vl); va_end(vl); return ret; } int main(void) { my_printf("Rounding:\t%f %.0f %.32f\n", 1.5, 1.5, 1.3); my_printf("Padding:\t%05.2f %.2f %5.2f\n", 1.5, 1.5, 1.5); my_printf("Scientific:\t%E %e\n", 1.5, 1.5); my_printf("Hexadecimal:\t%a %A\n", 1.5, 1.5); }
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 13 HOURS 56 MINUTES 00 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
Rounding: 1.500000 2 1.30000000000000004440892098500626 Padding: 01.50 1.50 1.50 Scientific: 1.500000E+00 1.500000e+00 Hexadecimal: 0x1.8p+0 0X1.8P+0
References
- 哋它亢17 standard (ISO/IEC 9899:2018):
- 7.21.1 Introduction (p: 217-218)
- 7.21.2 Streams (p: 217-219)
- 7.21.2 Files (p: 219-221)
- 哋它亢11 standard (ISO/IEC 9899:2011):
- 7.21.1 Introduction (p: 296-298)
- 7.21.2 Streams (p: 298-299)
- 7.21.2 Files (p: 300-302)
- 哋它亢99 standard (ISO/IEC 9899:1999):
- 7.19.1 Introduction (p: 262-264)
- 7.19.2 Streams (p: 264-265)
- 7.19.2 Files (p: 266-268)
- 哋它亢89/C90 standard (ISO/IEC 9899:1990):
- 7.9.1 Introduction
- 7.9.2 Streams
- 7.9.3 Files
See also
object type, capable of holding all information needed to control a C I/O stream (typedef) |