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


Groups > comp.lang.c > #12739

Re: fscan: about it

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: fscan: about it
Date 2011-11-05 11:54 +1300
Message-ID <9hj8ovF62fU5@mid.individual.net> (permalink)
References <0636e7d1-01db-4dde-9c89-c84840b9b7d6@hc5g2000vbb.googlegroups.com>

Show all headers | View raw


On 11/ 5/11 11:41 AM, Pasquale Frega wrote:
> Ok, a simple question: can fscan get a simple return with nothing or a
> simple escape or anything?

I assume you meant scanf?

> please try this simple code:
> #include<stdio.h>;

Don't put a semicolon after an include directive.

> #include<math.h>;
> int main(void) {
>          int i;
>          puts("Enter an int number");
>          fscan("%d",&i);
>          printf("You have entered:&d\n", i);
> }

You really should post something that compiles.

> In this case fgets wait for a number or something from keyboard that
> is a string o charter too
> if you try to press return with nothing it does not go forward
> i hope to has be clean

fgets?

scanf will read until is sees something that isn't white-space or EOF.

You should check the return of (f)scanf, not the value you are trying to 
read.

-- 
Ian Collins

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


Thread

fscan: about it Pasquale Frega <zemir_fp@libero.it> - 2011-11-04 15:41 -0700
  Re: fscan: about it Ian Collins <ian-news@hotmail.com> - 2011-11-05 11:54 +1300
    Re: fscan: about it Keith Thompson <kst-u@mib.org> - 2011-11-04 23:04 -0700
      Re: fscan: about it Ian Collins <ian-news@hotmail.com> - 2011-11-05 20:12 +1300
        Re: fscan: about it Pasquale Frega <zemir_fp@libero.it> - 2011-11-05 04:47 -0700
          Re: fscan: about it James Kuyper <jameskuyper@verizon.net> - 2011-11-05 08:58 -0400
          Re: fscan: about it Keith Thompson <kst-u@mib.org> - 2011-11-05 13:28 -0700
  Re: fscan: about it Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-04 16:00 -0700
  Re: fscan: about it John Gordon <gordon@panix.com> - 2011-11-04 23:57 +0000

csiph-web