2011-06-06 100 views

回答

2

爲了支持讀取和不同 格式的外部文件寫入,MorphX 設有一系列不同的IO 類; CommaIo逗號分隔 文件,Comma7Io逗號分隔7 位文件,BinaryIo二進制文件 和AsciiIo純文本文件。

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

+0

這是「開發Microsoft Dynamics AX」幫助文件的引用。 – 10p 2011-06-07 12:36:06

1

運行此作業

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(); 
} 

,並檢查該文件的內容:「ABCDEFG〜\ 300 \ 301 \ 302 \ 303 \ 304 \ 305 \ 306 \ 307 \ 310 \ 311 \ 312 \ 313〜HIJKLMNOP「。如您所見,8位字符已被其octal codes取代。

如果將io = new Comma7Io(filename, mode);替換爲io = new CommaIo(filename, mode);,原始字符串將被寫入文件:「ABCDEFG〜ÀÁÂÄÆÆÇÈÉÊË〜HIJKLMNOP」。