我的用意是将“条码”写到档案中。 法典如下:
byte[] stream = { 10, 20, 30, 40, 60 };
for (int i = 0; i < 2; i++)
{
FileStream aCmdFileStream = new FileStream(@"c:inarydata.txt", FileMode.Append, FileAccess.Write, FileShare.None);
StreamWriter aStreamWriter = new StreamWriter(aCmdFileStream);
for (int ii = 0; ii < stream.Length; ii++)
{
aStreamWriter.Write(stream[ii]);
aStreamWriter.WriteLine();
aStreamWriter.BaseStream.Write(stream,0,stream.Length);
}
aStreamWriter.Close();
}
该法典的输出
(<
(<
(<
(<
(<10
20
30
40
60
(<
(<
(<
(<
(<10
20
30
40
60
When StreamWriter.Write()
is used it dumps the values which are stored in array. But StreamWriter.BaseStream.Write(byte[],int offset, int length)
, the values are totally different. What is the reason for this?