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文件的完整路径和名称。