Search:

Type: Posts; User: Adak

Search: Search took 0.06 seconds.

  1. Replies
    11
    Views
    12,088

    validValue=sscanf(stdin,"%f",&price); This...

    validValue=sscanf(stdin,"%f",&price);

    This doesn't work, since sscanf() uses what's in the buffer (stdin in this case), AT THAT MOMENT.

    Which is nothing.

    Stick with the good combo:
  2. Replies
    11
    Views
    12,088

    No, fgets() is good - it never leaves a mess...

    No, fgets() is good - it never leaves a mess behind on the input buffer -- as long as the char array it's feeding into, has enough room for the newline char, and the end of string char.

    scanf() is...
  3. Replies
    11
    Views
    12,088

    Yes, sscanf() and fgets make a lovely couple...

    Yes, sscanf() and fgets make a lovely couple dancing together. :D
  4. Replies
    11
    Views
    12,088

    1) fflush(stdin) doesn't work, for the same...

    1) fflush(stdin) doesn't work, for the same reason flushing your kitchen faucet won't work - it's not the toilet, and is an input stream, not an output stream.

    2) I don't see anything wrong with...
Results 1 to 4 of 4