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

This is a discussion on problem in using getchar() insted of fflush(stdin) within the C Programming forums, part of the General Programming Boards category; some where in where i have to use it.. like i m taking input and puting condition that input == ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 11:13 AM
  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21