我想要做的是将BinaryReader.ReadString()
读取的字符数量设置为1.我将此文件设置为
43 00 49 00 54 00 52 00 41
= C I t r a
显然我可以通过C I t r a
来阅读BinaryReader.ReadString()
,但我要做的就是删除字母之间的空格,并检查后面是否有任何字母{ {1}}。这就是我现在所拥有的
a
有没有办法让ReadString()一次读取1个字符而不是7个字符,因此它会读取//OF_name is the offset at which the name begins at
//sins there is a space between each letter, I do "I += 2"
for (int i = OF_name; i <= br.BaseStream.Length; i += 2)
{
br.BaseStream.Position = i;
byte check = br.ReadByte();
if (check == 0) break; //the file which contains the string always has a 7 byte space between the name bytes and the rest of the data.
string a = br.ReadByte().ToString(); //forgot that this just makes it be represented as a string (byte 43 => string "43" not "C")
}
然后C
然后读取I
依此类推?或者有没有办法像我一样做,但不是将t
转换为byte 43
而是将string "43"
转换为byte 43
?