Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.programmer.misc > #48

Re: It's right in front of me, I know it!

From Richard Kettlewell <rjk@greenend.org.uk>
Newsgroups comp.sys.mac.programmer.misc
Subject Re: It's right in front of me, I know it!
Date 2013-07-02 15:56 +0100
Organization Anjou
Message-ID <8761wtko2r.fsf@araminta.anjou.terraraq.org.uk> (permalink)
References <howard-272924.22055501072013@news.individual.net> <87mwq5l3b6.fsf@araminta.anjou.terraraq.org.uk> <howard-DD4D95.08531602072013@news.individual.net>

Show all headers | View raw


Howard S Shubs <howard@shubs.net> writes:
> Richard Kettlewell <rjk@greenend.org.uk> wrote:

>> Don’t use scanf if you want read whole lines, that’s not what it’s
>> designed for.
>
> Thanks.  I *do* see the "Room:" prompt, so I expect it's being flush()'d 
> at the same time as the following prompt.

Yes.

> I ended up using repeated calls to getchar(). :-/ I can't imagine
> there's a less efficient way to do it, but this works and it's not
> intended for long-term use.

If you want an integer entered on a line, use fgets and then read the
integer from the buffer, with with strtol or sscanf.

-- 
http://www.greenend.org.uk/rjk/

Back to comp.sys.mac.programmer.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

It's right in front of me, I know it! Howard S Shubs <howard@shubs.net> - 2013-07-01 22:05 -0600
  Re: It's right in front of me, I know it! Richard Kettlewell <rjk@greenend.org.uk> - 2013-07-02 10:27 +0100
    Re: It's right in front of me, I know it! Howard S Shubs <howard@shubs.net> - 2013-07-02 08:53 -0600
      Re: It's right in front of me, I know it! Richard Kettlewell <rjk@greenend.org.uk> - 2013-07-02 15:56 +0100
        Re: It's right in front of me, I know it! Howard S Shubs <howard@shubs.net> - 2013-07-02 21:46 -0600

csiph-web