1.先读取文件
2.统计
///
/// 文件的读取
///
/// 文件地址
///
public string fileReaders(string path)
{
FileStream fs = File.Open(path, FileMode.Open);
StreamReader sr = new StreamReader(fs, Encoding.Default);
StringBuilder con = new StringBuilder();
do
{
con.Append(sr.ReadLine());
} while (sr.Peek() > -1);
fs.Close();
fs.Dispose();
sr.Close();
sr.Dispose();
return con.ToString();
}
///前台调用
string str=fileReaders(文件地址);
long length=(long)str.Length;