Thread: counting problem

  1. #16
    Registered User
    Join Date
    Mar 2007
    thank you Quzah. but, can you explain what stdin and ungetc? Upto this chapter, i haven't seen ungetc. I have just seen getc, getcha.

    And, suppose, the user enter following line in the prompt:

    am testing eieseisie michael eissen, the footballer#

    Does the line upto # will be in buffer and read one by one by first getchar() and pass to char ch ?

  2. #17
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    stdin is the standard input stream. It's commonly the input from your keyboard.
    stdout is the standard output stream, commonly you see this output on your monitor.

    You can scatter a few printf statements around in the loop to get a better understanding of it. All it does is read one character at a time over and over from the input stream, then compares it.

    ungetc will let you replace the last character you've read back onto the input stream, provided you've kept track of it. You must unget the same character you just pulled off of it, and you can't call it multiple times to unget more than one character. It only does one.

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  3. Segmentation Fault Problem: Urgent Help
    By bodydrop in forum C Programming
    Replies: 3
    Last Post: 05-05-2006, 08:02 PM
  4. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM