我有二进制文件BinaryFile读取为byte []
BinaryWriter binwriter = new BinaryWriter(File.Open("C:\\temp\\Users.bin", FileMode.Create));
binwriter.Write(buff);
binwriter.Close();
它的工作原理,但我怎么可以从这个文件中读取数据? 我需要每次都读新行,而不是文件结尾。
BinaryReader binreader = new BinaryReader(File.Open("C:\\temp\\Users.bin", FileMode.Open));
byte[] m = binreader.ReadBytes(??????); //I to read only 1 line to m, and then I need to read again new line to m.
如果它是一个*二进制*文件,那么就没有“线”的概念。这是特定于*文本*。请提供更多信息。 –
我写到文件数组像m,我想读取他们,我的意思是1阵列m – user3102962
不,根本不清楚。你是什么意思的“文件阵列”?如果这是任意的二进制数据,那么你认为“线”是什么?例如,假设文件实际上包含一段以MP3编码的音乐 - 在这种情况下,“线”意味着什么?了解数据的性质并对其进行相应处理至关重要。 –