System.io.FileStream
-
how do i tell if my filestream is at the end of the file char[] holder=new char[256]; FileStream fs=new FileStream("c:\\temp.txt",FileAccessmode.Read) while ()//don know what to put there { fs.read(holder,0,256) } thanks chad
while (fs.Position < fs.Length)
for instance. -- Henrik Stuart (http://www.unprompted.com/hstuart/)
-
how do i tell if my filestream is at the end of the file char[] holder=new char[256]; FileStream fs=new FileStream("c:\\temp.txt",FileAccessmode.Read) while ()//don know what to put there { fs.read(holder,0,256) } thanks chad
-
how do i tell if my filestream is at the end of the file char[] holder=new char[256]; FileStream fs=new FileStream("c:\\temp.txt",FileAccessmode.Read) while ()//don know what to put there { fs.read(holder,0,256) } thanks chad
You can do it in loop and out of loop by checking to see if
Stream.Length
is equal toStream.Position
or checking the return value ofStream.Read/Byte
for 0. -
>= 0
:) top secret -
>= 0
:) top secretFileStream.Read
will return 0 when it gets to the end of the stream so you should test for the return value being> 0
and exit the loop on it being== 0
. James