首页 > 其他分享 >Unplugged.IbmBits

Unplugged.IbmBits

时间:2024-09-24 22:45:14浏览次数:1  
标签:stream int IbmBits writer reader var using Unplugged

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

相关文章