Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

fgets

Name: Anonymous 2011-07-15 1:55

If the length of my input exceeds the limit provided in fgets, is the input which is not read stored in the buffer for a later read, or trashed?

Name: Anonymous 2011-07-15 2:00

man fgets

Name: Anonymous 2011-07-15 2:02

>>2
Just says that reading stops after EOF or newline. Same question as above.

Name: Anonymous 2011-07-15 2:05

>>3
Also, I mean stream, not buffer. self-fix!

Name: Anonymous 2011-07-15 2:05

Why would the file's contents be trashed?

Name: Anonymous 2011-07-15 2:09

>>5
Assume this is input coming from stdin. Also assume I type some terribly large string in which the length is more than an arbitrarily defined character limit in fgets.

Name: Anonymous 2011-07-15 2:46

>>6
If you fill up the buffer it'd start blocking and you can't write any more.

Name: Anonymous 2011-07-15 6:51

>>6

Do you really set arbitrary limits in fgets?

Name: Anonymous 2011-07-15 9:12

fgets (fast gets) is slow. Use sfgets (super fast gets) instead.

Name: Anonymous 2011-07-15 11:38

>>8
Yes. Mostly to keep the programmer - probably an Indian - on his (women can't program) toes. I also make heavy use of obfuscated macros which have no practicality.

LUNIX QUALITY!

>>9
I'll certainly keep that in mind, thanks.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List