Liste des Groupes | Revenir à cl c |
On Sun, 9 Feb 2025 08:13:10 +0100[...]
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>
I have a _coherent_ file, with a few NL terminated lines of text.
I wonder what you mean by "coherent".
Usually I use fgets() in contexts where I process every line, like
>
while (fgets (buf, BUFSIZ, fd) != NULL) {
operate_on (buf);
}
// here the status of buf[] is usually not important any more
>
My actual context was different, like
>
while (fgets (buf, BUFSIZ, fd) != NULL) {
// buf[] contents are ignored here
}
operate_on (buf[]); // which I assumed contains last line
>
It depends on definition of "last line".
What do you consider "last line" of the file in which last character is
not LF?
The one before the last LF or one after? Your code would get
the latter.
Les messages affichés proviennent d'usenet.