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


Groups > comp.lang.c > #43027

Re: question about scanf

From Kaz Kylheku <kaz@kylheku.com>
Newsgroups comp.lang.c
Subject Re: question about scanf
Date 2014-04-16 21:38 +0000
Organization Aioe.org NNTP Server
Message-ID <20140416143634.820@kylheku.com> (permalink)
References <40832b-tro.ln1@rama.universe>

Show all headers | View raw


On 2014-04-16, TP <TP@frenoespam.fr.invalid> wrote:
> Hi everybody,
>
> I want to scan a string for an integer, but I don't want any other character 
> in the string after the integer, otherwise an error has to be raised.

This logically means that the integer must be followed by the end of the
stream.

1. scan just the integer.
2. if feof(stream) is true, you're done
3. otherwise, call getc(stream): if the result is EOF, you're done
4. otherwise, error: characters after integer

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

question about scanf TP <TP@frenoespam.fr.invalid> - 2014-04-16 21:06 +0200
  Re: question about scanf Kaz Kylheku <kaz@kylheku.com> - 2014-04-16 21:38 +0000
  Re: question about scanf Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-16 22:59 +0100
    Re: question about scanf TP <TP@frenoespam.fr.invalid> - 2014-04-21 08:01 +0200
  Re: question about scanf James Kuyper <jameskuyper@verizon.net> - 2014-04-16 18:15 -0400
  Re: question about scanf "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-20 09:47 -0400
  Re: question about scanf viju.kantah@gmail.com - 2014-04-20 07:04 -0700
    Re: question about scanf gazelle@shell.xmission.com (Kenny McCormack) - 2014-04-20 15:24 +0000
    Re: question about scanf "BartC" <bc@freeuk.com> - 2014-04-20 17:10 +0100

csiph-web