Sujet : Re: Buffer contents well-defined after fgets() reaches EOF ?
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 11. Feb 2025, 02:03:21
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <voe7kp$1f0us$3@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Pan/0.161 (Chasiv Yar; )
On Mon, 10 Feb 2025 13:58:05 -0500, James Kuyper wrote:
I don't see the contradiction. If "no characters are read into the
array", there is no such thing as "the last byte read into the array",
so a null byte has no location where it should be written. Therefore,
there's no reason for changing the contents of the array.
What if the array is only big enough for one byte? In this case, no
characters can be read into it. Is a trailing null inserted in this case?