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


Groups > comp.lang.c > #25932

Re: code

From Les Cargill <lcargill99@comcast.com>
Newsgroups comp.lang.c
Subject Re: code
Date 2012-09-04 18:49 -0500
Organization A noiseless patient Spider
Message-ID <k263p1$fdi$2@dont-email.me> (permalink)
References <k215tf$b93$1@speranza.aioe.org><0.c99f3778f5dea1cf9e21.20120903115142BST.87obln4bwh.fsf@bsb.me.uk><k22u1n$km6$1@speranza.aioe.org> <ln4nnex3ww.fsf@nuthaus.mib.org> <k238ne$fsc$1@speranza.aioe.org> <i6KdnTONAdf-3tvNnZ2dnUVZ_jmdnZ2d@bestweb.net> <k25vo9$54i$1@speranza.aioe.org>

Show all headers | View raw


Bill Cunningham wrote:
> Kenneth Brody wrote:
>
>> To be fair, it says "zero", not "0".  However, I would hope you would
>> know that the two are the same.
>>
>> It says, flat out:
>>
>>      These functions return the number of input items assigned.
>>
>> First, you don't say what man page(s) you are showing, so I am going
>> out on a limb and assuming that it's actually for fscanf(), as well
>> as the related functions such as scanf() and sscanf(), hence the use
>> of "these functions".
>
>      Yes. fscanf()
>
>> Your call to fscanf is:
>>
>>      *buf = fscanf(fp, "%i", buf);
>>
>> Hence, you are asking for (up to) 1 "item".
>>
>> Continuing the man page:
>>
>>>> This can be fewer than provided for, or even zero, in the event of
>>>> a matching failure.
>>
>> Therefore, the only possible non-error returns are 0 and 1.
>>
>> Had you requested (up to) three items, then 0, 1, 2, and 3 would be
>> the possible non-error returns.  It would be impossible for the man
>> page (or any other documentation, for that matter) to explicitly list
>> every possible non-error return.  The above two sentences describe
>> the possible return values in enough detail for any Engligh-speaking
>> programmer to extrapolate the exact list of possible values for the
>> exact situation at hand.
>
>      OK to be humble I don't call myself a programmer at all. Not by a long
> shot. I'm a wannabe. A dream. My approach to the whole fscanf thing I am
> told was the wrong way to go.
>
> Bill
>
>

It's a lot easier to get a copy of K&R and do the stuff in
there. If you get done early, do it twice :)

--
Les Cargill

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


Thread

code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-02 22:50 -0400
  Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-02 22:53 -0400
  Re: code Barry Schwarz <schwarzb@dqel.com> - 2012-09-02 21:21 -0700
  Re: code Keith Thompson <kst-u@mib.org> - 2012-09-02 22:23 -0700
    Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 06:56 -0400
  Re: code Angel <angel+news@spamcop.net> - 2012-09-03 07:47 +0000
  Re: code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-03 11:51 +0100
    Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 09:02 -0400
      Re: code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-03 15:02 +0100
        Re: code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-03 17:20 +0100
        Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 14:33 -0400
    Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 14:48 -0400
      Re: code Keith Thompson <kst-u@mib.org> - 2012-09-03 13:11 -0700
        Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 17:41 -0400
          Re: code Keith Thompson <kst-u@mib.org> - 2012-09-03 14:53 -0700
            Re: code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-03 23:10 +0100
          Re: code "osmium" <r124c4u102@comcast.net> - 2012-09-03 16:56 -0500
            Re: code Keith Thompson <kst-u@mib.org> - 2012-09-03 18:27 -0700
        Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 17:50 -0400
          Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 17:54 -0400
            Re: code Barry Schwarz <schwarzb@dqel.com> - 2012-09-03 15:12 -0700
            Re: code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-03 23:23 +0100
              Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 18:42 -0400
                Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 19:11 -0400
                Re: code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-04 00:16 +0100
                Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 20:01 -0400
                Re: code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-04 02:07 +0100
                Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-03 21:17 -0400
                Re: code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-04 02:24 +0100
                Re: code Barry Schwarz <schwarzb@dqel.com> - 2012-09-03 20:55 -0700
                Re: code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-09-04 11:16 +0100
              Re: code Kenneth Brody <kenbrody@spamcop.net> - 2012-09-04 14:09 -0400
          Re: code Kenneth Brody <kenbrody@spamcop.net> - 2012-09-04 14:07 -0400
            Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-04 18:35 -0400
              Re: code Les Cargill <lcargill99@comcast.com> - 2012-09-04 18:49 -0500
                Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-04 20:56 -0400
                Re: code "Bill Cunningham" <nospam@nspam.invalid> - 2012-09-04 22:05 -0400

csiph-web