legacy IBM formatted bits like EBCDIC, big endian and floating point
using (var stream = File.OpenWrite("punchcard.bin"))
using (var writer = new BinaryWriter(stream))
{
writer.WriteEbcdic("Hello, World");
writer.WriteIbmSingle(3.14f);
writer.WriteBigEndian((Int16) 13);
writer.WriteBigEndian((Int32) 54321);
}
using (var stream = File.OpenRead("punchcard.bin"))
using (var reader = new BinaryReader(stream))
{
string text = reader.ReadStringEbcdic(12);
float f = reader.ReadSingleIbm();
int i16 = reader.ReadInt16BigEndian();
int i32 = reader.ReadInt32BigEndian();
}
https://github.com/jfoshee/unpluggedibmbits
标签:stream,int,IbmBits,writer,reader,var,using,Unplugged From: https://www.cnblogs.com/ives/p/18430247