[★★★只有10分了....] 读取 文件 的方法 ??
小弟目前   会   从文本文件中读取数据. 
    读写   二进制文件............................   
 给我一个   .txt   文件.我知道用   文本文件方式读取.. 
 给我一个   二进制文件..我也可以读出来..   
 但是   给我一个   .ini   文件,,我就不知道以哪种方式读取   ??   
 还有很多   像.txt      .data.      .ini      .dif   .bmf      .dll   .excel   .word      
 如何去   辨别一个文件,,并能用某种方式   读取出来..?? 
 文件   存储的方式   只有2   种吗?   文本文件和   二进制文件   ..? 
------解决方案--------------------所有文件都可用二进制读取,文本文件也可以用文本文件特殊的读法.   
 关键在于你读出来干什么
------解决方案--------------------public class IniFile  
 {  
 //文件INI名称  
 public string Path;    
 ////声明读写INI文件的API函数  
 [DllImport( "kernel32 ")]    
 private static extern long WritePrivateProfileString(string section,string key,string val,string filePath);      
 [DllImport( "kernel32 ")]    
 private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder retVal,int size,string filePath);       
 //类的构造函数,传递INI文件名  
 public IniFile(string inipath)  
 {  
 //  
 // TODO: Add constructor logic here  
 //  
 Path = inipath;  
 }    
 //写INI文件  
 public void IniWriteValue(string Section,string Key,string Value)  
 {  
 WritePrivateProfileString(Section,Key,Value,this.Path);    
 }    
 //读取INI文件指定  
 public string IniReadValue(string Section,string Key)  
 {  
 StringBuilder temp = new StringBuilder(255);  
 int i = GetPrivateProfileString(Section,Key, " ",temp,255,this.Path);  
 return temp.ToString();    
 }      
 }  
 这是一个读INI文件的东东