标签:oid bin tor com string blog .com length img
1.
2.
3.
private void readConfig()
{
string cfgpath = System.IO.Path.Combine(Environment.CurrentDirectory + "\\u3d", "config.txt");
//读取editConfig里面的IP
System.IO.FileInfo fi = new System.IO.FileInfo(cfgpath);
long len = fi.Length;
System.IO.FileStream fs = new System.IO.FileStream(cfgpath, System.IO.FileMode.Open);
byte[] buffer = new byte[len];
fs.Read(buffer, 0, (int)len);//把文件流fs写入到缓冲区buffer中
fs.Close();
string str = Encoding.UTF8.GetString(buffer);//unicode是乱码,utf是正常字符串
UserData.serverIP = str;
}
标签:oid bin tor com string blog .com length img
原文地址:http://www.cnblogs.com/Study02/p/7357253.html