问题1:StreamReader不能读取中文或读取中文乱码
答案1: using (StreamReader sr=new StreamReader(filename,System.Text.Encoding.Default)) {}
问题2: 读取ini文件
答案2: using System.Runtime.InteropServices;
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
{...
StringBuilder temp = new StringBuilder(500);
GetPrivateProfileString(section, key, def, temp, 500, filePath);
string val = temp.ToString();
...}