Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
buffering of stdio streams
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Kenneth Brody, post: 2382551"] Jack Klein wrote: [... Linux / fdopen() / select() / fgets() ...] True. However, they are irrelevent to the actual question being asked, which boils down to his last sentence: "How can I tell if anything resides in the FILE's buffer?" The answer to that, AFAIK, is "you can't, without getting system-specific". Make a function, let's call it "GetFileUnreadBufferCount(FILE *f)", which will return the number of unread bytes in the FILE's buffer. Isolate it in a system-specific module, to make porting easier. Then, you can make system-specific versions of this function. Check with your compiler vendors documentation, newsgroup, or support, to find out if there is a way to do this with your specific compiler. (Hint: check the FILE structure definition. It's probably hidden in there.) Note, however, that even this, by itself, won't help you if there is a partial line in the buffer, as fgets() will still block unless the rest of the line is on the stream, but not yet read into the buffer. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
buffering of stdio streams
Top