[Python-Dev] Rehabilitating fgets

Tim Peters tim_one@email.msn.com
Sat, 6 Jan 2001 17:34:42 -0500


[Tim, pondering]
> ... But suppose I search "from the right", and ensure the buffer is
> free of null bytes before the fgets.

Even better, suppose I ensure the buffer is free of both null bytes and
newlines before the fgets; then if I search from the *left* for a newline
and find one, it must be that fgets found a line and it ends right there,
and this should usually obtain.  There's no need to search from the right
unless I don't find a newline ...