Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: scanf used for to get a line |
| Date | Sat, 05 Nov 2016 14:22:50 -0700 |
| Organization | None to speak of |
| Lines | 31 |
| Message-ID | <ln60o1vcyd.fsf@kst-u.example.com> (permalink) |
| References | <15ea8d6d-0173-491c-b6b5-b1c57dd61769@googlegroups.com> <236c25a6-8c18-4082-ab3a-86eb55fb2408@googlegroups.com> <nvfoa6$lsu$1@dont-email.me> <lnfun8zffj.fsf@kst-u.example.com> <5e06af91-eec8-42cd-87c4-99d2b448de84@googlegroups.com> <lnbmxwzab8.fsf@kst-u.example.com> <ba811315-30c5-49f8-b4c6-1a733e7a0ab2@googlegroups.com> <lnpomcxhlt.fsf@kst-u.example.com> <108db18d-12c1-4eaa-afc9-59e7c0ca7798@googlegroups.com> <lnr36rw0aq.fsf@kst-u.example.com> <3c58680e-35cb-4c1f-b53f-91d8d3fbf2f9@googlegroups.com> <ln7f8ix12l.fsf@kst-u.example.com> <0d349302-0a98-4fa3-a368-8ac76ca8c546@googlegroups.com> <ln37j6wu7n.fsf@kst-u.example.com> <6e55e023-285a-4041-9b7f-90fa65652279@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx02.eternal-september.org; posting-host="068e13fa936d4e49cf562f96621eaf4d"; logging-data="30532"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/aFN7C+MmKpjO9nKyv7KpG" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:wfP5ySD6fQMM846VSET519lam4o= sha1:OL1+V4muCVsD8W9C3/fQC0uLguM= |
| Xref | csiph.com comp.lang.c:95859 |
Show key headers only | View raw
supercat@casperkitty.com writes:
> On Friday, November 4, 2016 at 9:11:38 PM UTC-5, Keith Thompson wrote:
>> The behavior of what? A stream has no behavior by itself. The behavior
>> of any function that operates on a FILE* is defined by the description
>> of that function. If there's some construct whose behavior you think is
>> not defined in that case, please specify what it is.
>
> What part of the Standard specifies the behavior of fgets in case stdin
> returns one character that isn't a newline and then reports EOF but does
> not report an error? The Standard describes the behavior in cases where
> a stream reports an EOF before returning any characters, and in cases
> where the stream reports an error, but I do not see any description of
> what fgets is required to do in case the stream returns one or more
> characters followed by EOF, but does not report an error.
N1570 7.21.7.2p1:
The fgets function reads at most one less than the number of
characters specified by n from the stream pointed to by stream
into the array pointed to by s. No additional characters are
read after a new-line character (which is retained) or after
end-of-file. A null character is written immediately after the
last character read into the array.
How is that unclear in the case you describe?
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"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
scanf used for to get a line asetofsymbols@gmail.com - 2016-11-01 01:50 -0700
scanf used for to get a line asetofsymbols@gmail.com - 2016-11-01 01:55 -0700
Re: scanf used for to get a line mark.bluemel@gmail.com - 2016-11-01 03:55 -0700
Re: scanf used for to get a line "Charles Richmond" <numerist@aquaporin4.com> - 2016-11-03 11:23 -0500
Re: scanf used for to get a line Keith Thompson <kst-u@mib.org> - 2016-11-03 09:38 -0700
Re: scanf used for to get a line supercat@casperkitty.com - 2016-11-03 10:08 -0700
Re: scanf used for to get a line Keith Thompson <kst-u@mib.org> - 2016-11-03 11:29 -0700
Re: scanf used for to get a line supercat@casperkitty.com - 2016-11-03 14:37 -0700
Re: scanf used for to get a line Keith Thompson <kst-u@mib.org> - 2016-11-03 16:34 -0700
Re: scanf used for to get a line supercat@casperkitty.com - 2016-11-04 10:21 -0700
Re: scanf used for to get a line Keith Thompson <kst-u@mib.org> - 2016-11-04 11:46 -0700
Re: scanf used for to get a line supercat@casperkitty.com - 2016-11-04 15:04 -0700
Re: scanf used for to get a line Keith Thompson <kst-u@mib.org> - 2016-11-04 16:44 -0700
Re: scanf used for to get a line supercat@casperkitty.com - 2016-11-04 17:13 -0700
Re: scanf used for to get a line Keith Thompson <kst-u@mib.org> - 2016-11-04 19:12 -0700
Re: scanf used for to get a line supercat@casperkitty.com - 2016-11-05 14:10 -0700
Re: scanf used for to get a line Keith Thompson <kst-u@mib.org> - 2016-11-05 14:22 -0700
Re: scanf used for to get a line Tim Rentsch <txr@alumni.caltech.edu> - 2016-11-15 10:57 -0800
Re: scanf used for to get a line supercat@casperkitty.com - 2016-11-15 12:05 -0800
Re: scanf used for to get a line jameskuyper@verizon.net - 2016-11-15 14:01 -0800
Re: scanf used for to get a line Tim Rentsch <txr@alumni.caltech.edu> - 2016-11-16 10:54 -0800
Re: scanf used for to get a line Richard Damon <Richard@Damon-Family.org> - 2016-11-21 18:01 -0500
Re: scanf used for to get a line supercat@casperkitty.com - 2016-11-21 15:44 -0800
Re: scanf used for to get a line asetofsymbols@gmail.com - 2016-11-03 13:35 -0700
Re: scanf used for to get a line Keith Thompson <kst-u@mib.org> - 2016-11-03 13:50 -0700
Re: scanf used for to get a line ImperiusDamian <damianblack.wolf@gmail.com> - 2016-11-05 16:10 -0400
Re: scanf used for to get a line Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-11-01 11:39 +0000
Re: scanf used for to get a line asetofsymbols@gmail.com - 2016-11-01 05:47 -0700
Re: scanf used for to get a line Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-11-01 15:05 +0000
Re: scanf used for to get a line asetofsymbols@gmail.com - 2016-11-02 01:42 -0700
csiph-web