从特定位置读取C#中的二进制文件 [英] Read binary file in C# from specific position
本文介绍了从特定位置读取C#中的二进制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从特定位置读取大型二进制文件?
Is it possible to read a large binary file from a particular position?
我不想从头开始读取文件,因为我可以计算出所需的流的开始位置和长度.
I don't want to read the file from the beginning because I can calculate the start position and the length of the stream I need.
推荐答案
using (FileStream sr = File.OpenRead("someFile.dat"))
{
sr.Seek(100, SeekOrigin.Begin);
int read = sr.ReadByte();
//...
}
这篇关于从特定位置读取C#中的二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文