X++ 这方面使用的是.net Framework,读取文件时,要权限放行。
以下代码,会看到可爱的System.IO.SteamReader。如此熟悉,感动ing。。。
static void readJob(Args _args) { System.IO.StreamReader m_streader; InteropPermission m_Perm = new InteropPermission(InteropKind::ClrInterop); Notes m_Notes; m_Perm.assert(); m_streader = new System.IO.StreamReader( @" C:\ms\n01yan_100.copy "); while(int642int(m_streader.Peek())> 0) { m_Notes += m_streader.ReadToEnd(); } m_streader.Close(); m_streader.Dispose(); CodeAccessPermission::revertAssert(); info(m_Notes); // pause; }
写入
static void StreamWriter(Args _args) { System.IO.StreamWriter sw; InteropPermission perm = new InteropPermission(InteropKind::ClrInterop); SalesTable st; ; perm.assert(); sw = new System.IO.StreamWriter( @" C:\test.txt "); while select st { sw.WriteLine(st.SalesId); sw.WriteLine(st.CustAccount + " " + Date2str(st.DeliveryDate, 321, 2, 3, 2, 3, 4)); } sw.Flush(); sw.Close(); sw.Dispose(); CodeAccessPermission::revertAssert();}
转载于:https://www.cnblogs.com/Kurodo/archive/2011/12/13/2285985.html
相关资源:黑金ax7101和7102 DDR3读写测试仿真例程及代码