我正在使用 C# 读取文件,我需要(有时)在输出下一个字节之前跳过几个字节。例如:
31 32 33 34 35 36 37 38 39
我想跳过前两个(或任何给定数量)字节,然后输出下一个。问题是,使用下面的代码不会这样做,我不知道该怎么做。我需要能够在整个程序中使用“跳过”功能。如果有人可以帮助我,我将不胜感激!
String fileDirectory = "C:\\t.txt";
StreamReader reader = new StreamReader(fileDirectory);
long stickNoteLength = fileDirectory.Length;
int hexIn;
String hex = "";
for (int i = 0; (hexIn = reader.Read()) != -1; i++)
{
for (int x = 0; x < 2; x++)
{
hex = hexIn.ToString("X2");
}
MessageBox.Show(hex);
}