Thread: fgetc problem

  1. #1
    Musicman - Canora
    Join Date
    Aug 2005

    fgetc problem

    hey guys im trying to check whether a user has keyed in
    a certain character whether that be 's' 'u' or 'f' and if they have not keyed in those characters i want it to loop back and ask for input again.

    i need to use something like fgetc or something like that which is able to input just a simple char.
    If its bad input how do i get it to ask for input again

       if(type != 's' || type != 'u' || type != 'f')
             printf("wrong input only s, uor f is accepted");
    while(type = fgetc(stdin)) != '\n' && type != EOF));

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM
  5. possible problem with fgetc?????
    By iamvarg in forum C Programming
    Replies: 4
    Last Post: 11-15-2006, 11:51 AM
Website Security Test