#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    35
    Rep Power
    1

    What is the use of ungetch?


    what is the use of ungetch?
    How can i implement?
    Is ungetch is predefined in somewhere?
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    conio, yet again. It is not part of the standard, which means that it may or may not be supported by any given C compiler.

    There are times when you want to be able to test what the next character in the input buffer is, but also want it to be the next one read after that test. ungetch undoes the get, meaning that it "puts the character back".

    I just told you how to see if your gcc supports conio.
  4. #3
  5. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    BTW, the standard function is ungetc:

    int ungetc (int, FILE*);

    It works with any file, including the standard input file, stdin). And it is supported by every C compiler that complies to the standard.

IMN logo majestic logo threadwatch logo seochat tools logo