现在的位置: 首页 > 综合 > 正文

读写ini文件

2012年04月01日 ⁄ 综合 ⁄ 共 541字 ⁄ 字号 评论关闭
1.C#申明INI文件的写操作函数WritePrivateProfileString():
[ DllImport ( "kernel32" ) ]
            private static extern long WritePrivateProfileString ( string
            section ,
            string key , string val , string filePath ) ;

 

参数说明:section:INI文件中的段落;key:INI文件中的关键字;val:INI文件中关键字的数值;filePath:INI文件的完整的路径和名称。

2.C#申明INI文件的读操作函数GetPrivateProfileString():

[ DllImport ( "kernel32" ) ]
            private static extern int GetPrivateProfileString ( string section ,
            string key , string def , StringBuilder retVal ,
            int size , string filePath ) ;

参数说明:section:INI文件中的段落名称;key:INI文件中的关键字;def:无法读取时候时候的缺省数值;retVal:读取数值;size:数值的大小;filePath:INI文件的完整路径和名称。

抱歉!评论已关闭.