I am working with a few text files that range from 1-2 Gig in size. I cannot use the conventional streamreader and decided to read in chuncks and do my work. The problem is that I am not sure when the end of the file is reached since it has been working on one file for a long time and I am not sure how much larger I can make by buffer to read. Here is the code:
dim Buffer_Size = 30000
dim bufferread = new [Char](Buffer_Size - 1){}
dim bytesread as integer = 0
dim totalbytesread as integer = 0
dim sb as new stringbuilder
Do
bytesread = inputfile.read(bufferread, 0 , Buffer_Size)
sb.append(bufferread)
totalbytesread = bytesread + totalbytesread
if sb.length > 9999999 then
data = sb.tostring
if not data is nothing then
parsingtools.load(data)
endif
endif
if totalbytesread > 1000000000 then
logs.constructlog("File almost done")
endif
loop until inputfile.endofstream
is there any control or code that I can check how much of the file remains?