stdin(3) Library Functions Manual stdin(3) stdin, stdout, stderr - / C (libc, -lc) #include extern FILE *stdin; extern FILE *stdout; extern FILE *stderr; Under normal circumstances every UNIX program has three streams opened for it when it starts up, one for input, one for output, and one for printing diagnostic or error messages. These are typically attached to the user's terminal (see tty(4)) but might instead refer to files or other devices, depending on what the parent process chose to set up. (See also the "Redirections" section of sh(1).) << >>; << >>; << >>. ( stdin, stdout stderr) . stdio(3) FILE fprintf(3) fread(3). FILE -- UNIX, , , UNIX, read(2) lseek(2). stdin, stdout stderr 0, 1 2, . STDIN_FILENO, STDOUT_FILENO STDERR_FILENO ( freopen(3) , ). , FILE ( : POSIX.1, 8.2.3, ). : , stdio . , , , exec(3) , . stdin, stdout stderr , . freopen(3), stdin, stdout stderr. exit(3) . C11, POSIX.1-2008. The standards also stipulate that these three streams shall be open at program startup. C89, POSIX.1-2001. stderr . stdout , . , fflush(3) exit(3), . , . ( ) setbuf(3) setvbuf(3). , stdin , , stdio ( , ). tcsetattr(3) ; stty(1) termios(3). csh(1), sh(1), open(2), fopen(3), stdio(3) () Alexander Golubev , Azamat Hackimov , Hotellook, Nikita , Spiros Georgaras , Vladislav , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () . Linux man-pages 6.18 21 2025 . stdin(3)