Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: fscan: about it |
| Date | 2011-11-04 23:04 -0700 |
| Organization | None to speak of |
| Message-ID | <ln4nyjf6l1.fsf@nuthaus.mib.org> (permalink) |
| References | <0636e7d1-01db-4dde-9c89-c84840b9b7d6@hc5g2000vbb.googlegroups.com> <9hj8ovF62fU5@mid.individual.net> |
Ian Collins <ian-news@hotmail.com> writes:
> 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.
With gcc, it compiles with a couple of warnings. By my reading of
6.10.2, an extra semicolon on a #include directive doesn't even violate
a constraint or syntax rule (but it does have undefined behavior).
The typo "&d" for "%d" doesn't even cause undefined behavior; it just
prints the string literal and ignores the second argument.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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