Thread: problem in using getchar() insted of fflush(stdin)

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    82

    problem in using getchar() insted of fflush(stdin)

    some where in where i have to use it.. like i m taking input and puting condition that input == 1 or 2 then .....else go back to input...... but when user inputs any charachter there it goes for unfinite loop.. this problem is sorting out by using fflush(stdin);


    what to use instead??

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Give people more than 2 mins to respond to your other thread.
    Help me with fflush(stdin) need an altnative method
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie Question - fflush(stdin) & fpurge(stdin) on Mac and PC
    By tvsinesperanto in forum C Programming
    Replies: 34
    Last Post: 03-11-2006, 12:13 PM
  2. new problem after not using fflush(stdin)
    By megablue in forum C Programming
    Replies: 2
    Last Post: 07-04-2003, 08:54 AM
  3. fflush(stdin);
    By ygfperson in forum C++ Programming
    Replies: 2
    Last Post: 08-11-2002, 06:23 PM
  4. fflush(stdin)
    By RyeDunn in forum C Programming
    Replies: 24
    Last Post: 07-18-2002, 09:07 PM
  5. ascii 10 in the stdin after fflush(stdin)??
    By Kev2 in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 06-03-2002, 03:53 PM