3 Sep
2008
3 Sep
'08
12:49 a.m.
Jesus Cea wrote:
How do you differenciate between that empty string (when doing "read(0)"), from EOF (that is signaled by an empty string)?.
If you need to be able to make that distinction, then you have to be careful not to try to read 0 bytes. Personally I've never come across a situation where allowing read(0) to occur would have simplified the code. In the usual keep-reading-until-we've-got-the- required-number-of-bytes scenario, you're checking for 0 bytes left to read in order to tell when to stop. -- Greg