About some abstracts reading text files

xiaoxiao2021-03-06  108

About some abstracts reading text files

Http://community.9cbs.net/expert/topic/3274/3274491.xml?temp =.4443323 adds to Antingz (Qiwuo), where you use StreamReader, please habit on system.text.encoding.default , Or we

Chinese can't display correctly. Dim file as new system.io.StreamReader ("c: /test.txt", system.text.encoding.default) DIM Strline As string strline = file.readline () 'reads Chapter 1 MessageBox.Show (Strline) Strline = file.readline () 'Read the 2nd line MessageBox.show (strline) file.close ()

Enter CHR (13) / R / N is a wrap bus return / n

Http://chs.gotdotnet.com/quickstart/howto/default.aspx?url=/quickstart/howto/doc/anagrams.aspx

http://community.9cbs.net/expert/topic/2828/2828051.xml?temp =.508465 Write StreamWriter SW = file.AppendText (FilePath); sw.close ()

Read StreamReader Sr = New StreamReader (".// Description .txt", Encoding.default); String Input = ""; while ((Input = sr.readline ())! = Null) {} sr.close ()

FileStream fs = new FileStream (filename, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read) http://community.9cbs.net/Expert/topic/2814/2814490.xml?temp=.7782404/ modification; StreamWriter ww = New streamwriter (fs, system.text.encoding.utf8); ww.basestream.seek (-6, seekorigin.end); ww.write (text); .............

FILESTREAM FS = New FileStream ("C: //Test.txt", FileMode.Openorcreate, FileAccess.

READWRITE, Fileshare.read; streamwriter ww = new streamwriter (fs, system.text.Encoding.

Default); int POS = 6; Byte [] lastbyte = new byte [POS]; ww.basestream.seek (-pos, seekorigin.end); fs.read (Lastbyte, 0, POS); string laststr = system.text .Encoding.default.getstring (Lastbyte

WW.BaseStream.seek; string appendstr = "bbbbbb"; ww.write (appendstr laststr); ww.flush (); ww.close (); fs.close (); large text file count http://community.9cbs.net/Expert/topic/2803/2803134.xml?temp=.6808435int line_count = 0; try {StreamReader sw = new StreamReader (File_path, System.Text.Encoding.GetEncoding ( "GB2312"); string line = ""; while ((line = sw.readline ())! = Null) {line_count = 1;} sw.close;} catch (exception ex) {messagebox.show (ex. Message);

How to empty the content of a text file, but do not delete this file http://community.9cbs.net/expert/topic/2788/2788580.xml?temp =.4243738dim Writer as new streamwriter ("c: /sample.txt ", False) Writer.write (Nothing)

Messagebox.show ("a total of" line_count.toString () "line");

C # Write text file How to wrap http://community.9cbs.net/expert/topic/2725/2725488.xml?temp =.644848webform, C # Write a text file. . In the back / n, / n / r, / r / n, there is no problem in the place where the wrap in Win2K's notepad has appeared, but there is no problem if you use EditPlus. . . .

How should I pick it up. . . . How to use VBCRLF and C # in VB.NET. . .

R / N Should Work

For example:

Using system.io;

StreamWriter SW = New Streamwriter ("Testfile.cs.txt", False, System.Text.Encoding.Getencoding ("GB

2312 ")); SW.WRITE (" Hello / R / NWORLD "); SW.CLOSE ();

How to get the number of rows of text files? Online, etc. http://community.9cbs.net/expert/topic/2662/2662493.xml?temp=.7574121streamReader sr = new streamreader (filename); int line = 0; while (sr.readline ()! = Null) {line ;}

Already complete, another method: This method can expand a lot of other applications: It is very beneficial for learning familiar files: system.io.streamReader XX = new system.io.streamReader ("f: //a.txt" ); int GETB = xx.basestream.readbyte (); int Add = 1; while (getb! = - 1) {if (getb == 13 && xx.basestream.readbyte () == 10) {add ; xx. BaseStream.position -;} getb = xx.basestream.readbyte ();} this.label1.text = add.tostring (); To BankLiu (Shui Shore) is actually single only characters '/ n' or '/ r' Calculate the wrap, so it should be like this: while (getB! = - 1) {if (getb == 13 || Getb == 10) {add ; if (getb == 13 && xx.basestream.readbyte () == 10 ) Xx.basestream.position ;} getb = xx.basestream.readbyte ();

20040827

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

New Post(0)