counting problem

This is a discussion on counting problem within the C Programming forums, part of the General Programming Boards category; thank you Quzah. but, can you explain what stdin and ungetc? Upto this chapter, i haven't seen ungetc. I have ...

  1. #16
    Registered User
    Join Date
    Mar 2007
    Posts
    9
    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
    Posts
    14,826
    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.


    Quzah.
    Hope is the first step on the road to disappointment.

Page 2 of 2 FirstFirst 12
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, 03:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM
  3. Segmentation Fault Problem: Urgent Help
    By bodydrop in forum C Programming
    Replies: 3
    Last Post: 05-05-2006, 09: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

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