Hi all.
I have some files that are binary TIF files with an ASCII header.
I wrote an app to read them, pull some values from the header, and write everything after the header as a tif.
I'm doing the reading and writing with binaryreader and binarywriter and it works, but when it goes into the loop to write out the new file it goes to 100% CPU.
Below is parts from the code dealing with writing the file, the code for the header bit is not included.
Any help and / or suggestions would be very much appreciated. I'm kind of at a loss on this one.
TIA!
I have some files that are binary TIF files with an ASCII header.
I wrote an app to read them, pull some values from the header, and write everything after the header as a tif.
I'm doing the reading and writing with binaryreader and binarywriter and it works, but when it goes into the loop to write out the new file it goes to 100% CPU.
Below is parts from the code dealing with writing the file, the code for the header bit is not included.
VB.NET:
Dim fsIn As FileStream = New FileStream(filename, FileMode.OpenOrCreate)
Dim fsOut As FileStream = New FileStream(fsIn.Name & ".tif", FileMode.Create)
Dim binWriter As BinaryWriter
Dim binReader As BinaryReader = New BinaryReader(fsIn)
binWriter = New BinaryWriter(fsOut)
Do While binReader.BaseStream.Position < binReader.BaseStream.Length
binWriter.Write(binReader.ReadByte)
Loop
'Close everything out
binWriter.Flush()
binWriter.Close()
binReader.Close()
binReader = Nothing
fsIn.Close()
fsIn = Nothing
fsOut.Close()
fsOut = Nothing
Any help and / or suggestions would be very much appreciated. I'm kind of at a loss on this one.
TIA!