confuse

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rajnish Anand
    New Member
    • Aug 2007
    • 3

    confuse

    hello friends!
    would you plz explain in details about getc,getchar(), getch(),getche .how these are important in c.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by Rajnish Anand
    hello friends!
    would you plz explain in details about getc,getchar(), getch(),getche .how these are important in c.
    Moved to C++ forum

    Comment

    • Girish Kanakagiri
      New Member
      • May 2007
      • 93

      #3
      Originally posted by Rajnish Anand
      hello friends!
      would you plz explain in details about getc,getchar(), getch(),getche .how these are important in c.
      prototype of getc is
      int getc ( FILE * stream );
      To identify whether end of file encoutered etc by the int value returned.

      prototype of getchar is
      int getchar ( void );
      Returns next character from standard input.


      getchar
      This is a standard function that gets a character from the stdin.

      getch
      This is a nonstandard function that gets a character from keyboard, does not echo to screen.

      getche
      This is a nonstandard function that gets a character from the keyboard, echoes to screen. You need not press Enter key after pressing the character

      Use getchar if you want it to work on all compilers. Use getch or getche on a system that supports it when you want keyboard input without pressing [Enter].

      And note that the return value of all are int! You need this to properly check for EOF

      Regards,
      Girish.

      Comment

      Working...