Checking for EOF with Streamreader

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi. What is the best way to check for EOF when using the streamreader? I am using a do loop. Following is what I have tried but all end in an error when eof is reached.

1. Adding 'until line is nothing' to the end of the loop.
2. Adding 'while not line is nothing' after the do.
3. After the line is read in the do coding:
If line Is Nothing Then
Exit Do
End If

Thanks for your help!

>From http://www.developmentnow.com/g/38_2005_8_0_22_0/dotnet-languages-vb.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
.



Relevant Pages

  • Re: detab utility challenge.
    ... I know he is not suggesting anyone write such a silly loop. ... Once the character returned is EOF, ... Once getc returns EOF (by the way, ...
    (comp.lang.c)
  • Re: malloc + 4??
    ... >the screen or to a file, there aren addition 4 characters. ... This loop tries to count the size of the file by calling getc ... until getcreturns EOF. ... yet also return the special marker value EOF. ...
    (comp.lang.c)
  • Re: K&R 1.5.1 exercise
    ... Your while loop will eventually cause integer overflow, ... > It would have been even better if you used a loop, with getchar!= EOF ... > getchar() call will return the code of the first character you have typed ...
    (comp.lang.c)
  • Re: detab utility challenge.
    ... I know he is not suggesting anyone write such a silly loop. ... Once the character returned is EOF, ... possible input characters", and the gods must be crazy, since they are ...
    (comp.lang.c)
  • Re: determine last line of file entries
    ... is being used to detect eof. ... I would suggest reworking the loop into a dowhile ... The while loop condition could be used to check that your entire read/write ... buffer was filled, and the if condition would check for the eof value. ...
    (comp.lang.c)