
// --- Write a 400M file containing one big5 character 陸 ---
StreamWriter bigWriter = new StreamWriter(@"big5.txt", false, Encoding.GetEncoding("big5"));
for (int i = 0; i < 209715200; i++) bigWriter.Write("陸");
bigWriter.Close();
Console.WriteLine("Writing Done");
// --- Read big5 characters from the 400M file ---
StreamReader bigReader = new StreamReader(@"big5.txt", Encoding.GetEncoding("big5"));
// - print out the first big character -
char[] chars = new char[1];
bigReader.Read(chars, 0, 1);
Console.WriteLine(chars);
// - Read the rest and print the total number of characters read -
int counter = 1;
while (-1 != bigReader.Read()) counter++;
bigReader.Close();
Console.WriteLine("Reading Done: " + counter);
| 欢迎光临 FreeOZ论坛 (https://www.freeoz.org/ibbs/) | Powered by Discuz! X3.2 |