开发者

What is the difference between the CommaIO and Comma7IO classes?

There is no documentation in the help file as to the purpose of the Comma7IO class, just that it extends the CommaI开发者_高级运维O class.

What is the difference?


To support read and write of different formats of external files, MorphX features a range of different Io classes; CommaIo for comma separated files, Comma7Io for comma separated 7 bit files, BinaryIo for binary files and AsciiIo for plain text files.

From this link: RE: [Axapta-Knowledge-Village] Somthing cool - IO


Run this job

static void TestComma7Io(Args _args)
{
    str                 testString  = 'ABCDEFG~ÀÁÂÃÄÅÆÇÈÉÊË~HIJKLMNOP';
    str                 filename    = @"C:\TMP\test1.txt";
    str                 mode        = 'W';
    Io                  io;
    container           con;
    FileIoPermission    perm;
    ;

    perm = new FileIoPermission(filename, mode);

    if (!perm)
        return;

    perm.assert();

    // BP deviation documented.
    io = new Comma7Io(filename, mode);

    if (io)
        io.write(testString);

    CodeAccessPermission::revertAssert();
}

and check the content of the file: "ABCDEFG~\300\301\302\303\304\305\306\307\310\311\312\313~HIJKLMNOP". As you see, 8-bit characters have been replaced with their octal codes.

If you replace io = new Comma7Io(filename, mode); with io = new CommaIo(filename, mode); the original string will be written to the file: "ABCDEFG~ÀÁÂÃÄÅÆÇÈÉÊË~HIJKLMNOP".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜