Install Mono

xiaoxiao2021-03-06  40

Run the C # program under Red Linux 9.0:

(1) Go to www.go-mono.org, download the package (http://www.go-mono.org/archive/beta3/redhat-9-i386/)

Cairo-0.1.23-2.ximian.6.1.i386.23-2.ximian.6.1.236.rpm ICU-2.6.2-1.Ximian.6.0.i386.rpm libicu26-2.6 .2-1.ximian.6.0.i386.2-1.ximian.6.0.0.30.10.1-0.rpm libpixman-0.1.1-0.ximian.6.0.i386.rpm libpixman-wevol-0.1. 1-0.ximian.6.0.i386.rpm mono-core-0.96-1.ximian.6.2.i386.rpm mono-core-weapi-0.96-1.rpm mono-peapi-0.96-1 .ximian.6.2.i386.rpm mono-runtime-devel-0.96-1.ximian.6.2.i386.rpm

(2) Install MONO # rpm -uvh * .rpm

(3) Test # MCS Test.cs # mono test.exe

// ********** //test.cs // ****************** USING SYSTEM; Using System.IO;

class Directory {public static void Main (String [] args) {FileStream fs = new FileStream ( "log.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter w = new StreamWriter (fs); w.BaseStream.Seek ( 0, seekorigin.end; // set the file pointer to the end.

LOG ("Test1", W); LOG ("Test2", W);

W.close (); // Close the Writer and Underlying file.

FS = New filestream ("log.txt", filemode.openorcreate, fileaccess.read;

StreamReader R = New StreamReader (FS); R.BaseStream.seek; Dumplog (r);}

Public Static Void Log (String LogMessage, Streamwriter W) {W.Write ("Log Entry:"); w.writeLine ("{0} {1}", DateTime.now.tolongTimeString (), DateTime.now.tolongDateString ( ))); W.writeline (":"); w.writeline (": {0}", logmessage); w.writeLine ("--------------- ------------ "); w.flush ();} public static void Dumplog (StreamReader r) {while (r.peek ()> -1) {// while not at the end Of the file, Write to Standard Output. console.writeline (R.Readline ());}

}

R.close ();}}

转载请注明原文地址:https://www.9cbs.com/read-118424.html

New Post(0)