VC.net cli数组 如何读取文本文件

来源:百度知道 编辑:UC知道 时间:2024/05/30 07:36:18
如何在VC。netDE cli情况下 读取不定行数的文本文件到一个array里面去?

FileStream fs = new FileStream(文本文件路径, FileMode.Open);//打开文件流
StreamReader d = new StreamReader(fs); string s = d.ReadToEnd();//文本阅读器,从头读到尾。
string[] ss = s.Split(new string[] { "\r\n", "\r", "\n" },StringSplitOptions.None);//用换行符分割,"\r\n"为.Net标准换行符但 "\r" "\n" 也是被支持的。