BinaryWriter的尺寸不合适

时间:2018-10-22 09:18:05

标签: c# binarywriter

short[,] out2 = new short[1201, 1201];

FileStream fs = new FileStream(Application.StartupPath + "\\One_File\\result.hgt",
                               FileMode.OpenOrCreate, 
                               FileAccess.Write);
BinaryWriter bw = new BinaryWriter(fs);

for (int i = 0; i < 1201; i++)
{
  for (int j = 0; j < 1201; j++)
  {
    bw.Write(out2[i, j]);
  }
}

1201 * 1201 * 2 = 2 884 802字节

结果文件的大小为 2 883 584字节

为什么?

0 个答案:

没有答案