stdin, stdout and stderr

Home Forums C-programming.. stdin, stdout and stderr

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #2443 Reply
    Humble
    Keymaster

    Everyone heard about it.. How-ever confusion exist on this. I am talking these bits in context of C programming..

    When a program starts these 3 are already opened and available for you.. These are IO streams.

    In standard header file stdio.h it has been defined as

    extern struct _IO_FILE *stdin; /* Standard input stream. */
    extern struct _IO_FILE *stdout; /* Standard output stream. */
    extern struct _IO_FILE *stderr; /* Standard error output stream. */

    
    stdin   -> This reads input from the terminal and by default it access the keyboard..
    
    stdout  -> This writes output to the terminal and by default it send data to your screen/monitor.
    
    stderr  -> This writes diagnostic/error output to the terminal, by default it write same to stdout.
    
    
    Where stdin is opened in "r" mode and rest 2 are opened in "w" mode.
    
    Functions like gets() , getchar() reads from stdin.
    
    Functions like fgets(), fgetc(), fscnaf() ..etc can access stdin
    
    Functions like printf(), puts(), putchar() ..etc write/send data to stdout.
      
    Functions like  fprintf(), fputs() can use of stderr.
    
    Above mentioned streams (stdin,stdout,stderr)  all use text as the method of I/O.
    
Viewing 1 post (of 1 total)
Reply To: stdin, stdout and stderr
Your information: