StreamReader and StreamWriter apply to the operation of a text file because it is a character-based operation
Don't worry about coding.
using (Stream s = new FileStream (@ "C:\Users\qq\Desktop\ new Folder \html\qq.txt", FileMode.Open, FileAccess.Read)) using (StreamReader r = new StreamReader (s, encoding.default)) Reads the text in the stream { string str; The while ((str = r.readline ()) = NULL)//reads a row each time, when the read content is null Yes, read complete { Console.WriteLine (str); } }
It is a byte-to-read operation of the file.
using(Stream s =NewFileStream (@"C:\Users\qq\Desktop\ new Folder \html\qq.txt", FileMode.Open)) using(Stream w =NewFileStream (@"C:\Users\qq\Desktop\ new Folder \html\yzk.txt", FileMode.Create)) { //S.copyto (w);//Copying Files byte[] B =New byte[Ten]; intLen =0; while(len = S.read (b,0, b.length)) >0)//data to be read into the B-array {//Console.WriteLine (Encoding.Default.GetString (B,0,b.length));W.write (b,0, b.length); Writes the data in the array to a new file}}
IO stream operations in C # (FileStream)