Reading specified areas?
Reading specified areas?
In C# how would I make my file stream read from only 0x148 to EOF and be able to write it to a file?
Easiest way would be
Code: Select all
// open your file for reading
FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
// create the new file for writing
FileStream newFile = new FileStream(newFilePath, FileMode.Create, FileAccess.Write);
BinaryWriter bw = new BinaryWriter(newFile);
br.BaseStream.Position = 0x148;
int bytesToRead = (int)br.BaseStream.Length - 0x148;
bw.Write(br.ReadBytes(bytesToRead));
br.Close();
bw.Close();
-
- Posts: 5426
- Joined: Sat Jul 24, 2004 12:12 pm
- Location: I'm a Paranoid
- Contact: