如何从位置 x 开始的二进制文件中读取 y 值的 Shorts?
我需要从二进制文件中从特定位置开始读取一定数量的短(int16)数据点。谢谢!
I need to read a certain amount of short (int16) data points from a binary file, starting at a specific position. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样的事情应该为你做:
这基本上就是 CAsper 在代码中编写的内容
Something like this should do it for you:
which is basically what CAsper wrote just in code
您可以简单地调用传递给 BinaryReader 的 Stream 上的 Seek 方法到文件中要开始读取的位置。
然后,将流传递给 BinaryReader 后,您可以根据需要多次调用 ReadInt16 方法。
You can simply call the Seek method on the Stream that you pass to BinaryReader to the position in the file you want to start reading from.
Then, once you pass the stream to BinaryReader, you can call the ReadInt16 method as many times as you need to.