Ini文件操作函数
2015-01-22 13:08
197 查看
/// <summary> /// Copies a string into the specified section of an initialization file. /// </summary> /// <param name="lpAppName">The name of the section to which the string will be copied. If the section does not exist, it is created. The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters.</param> /// <param name="lpKeyName">The name of the key to be associated with a string. If the key does not exist in the specified section, it is created. If this parameter is NULL, the entire section, including all entries within the section, is deleted.</param> /// <param name="lpString">A null-terminated string to be written to the file. If this parameter is NULL, the key pointed to by the lpKeyName parameter is deleted.</param> /// <param name="lpFileName">The name of the initialization file.If the file was created using Unicode characters, the function writes Unicode characters to the file. Otherwise, the function writes ANSI characters.</param> /// <returns>If the function successfully copies the string to the initialization file, the return value is nonzero.</returns> [DllImport("kernel32")] private static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName); /// <summary> /// Retrieves a string from the specified section in an initialization file. /// </summary> /// <param name="lpAppName">The name of the section containing the key name. If this parameter is NULL, the GetPrivateProfileString function copies all section names in the file to the supplied buffer.</param> /// <param name="lpKeyName">The name of the key whose associated string is to be retrieved. If this parameter is NULL, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter.</param> /// <param name="lpDefault">A default string. If the lpKeyName key cannot be found in the initialization file, GetPrivateProfileString copies the default string to the lpReturnedString buffer. If this parameter is NULL, the default is an empty string, "".</param> /// <param name="lpReturnedString">A pointer to the buffer that receives the retrieved string.</param> /// <param name="nSize">The size of the buffer pointed to by the lpReturnedString parameter, in characters.</param> /// <param name="lpFileName">The name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param> /// <returns>The return value is the number of characters copied to the buffer, not including the terminating null character.</returns> [DllImport("kernel32")] private static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);
相关文章推荐
- PHP获取和操作配置文件php.ini的几个函数介绍
- PHP获取和操作配置文件php.ini的几个函数
- 简述配置文件ini及其操作函数GetPrivateProfileString等
- PHP获取和操作配置文件php.ini的几个函数介绍
- PHP获取和操作配置文件php.ini的几个函数
- PHP获取和操作配置文件php.ini的几个函数介绍
- PHP 的ini配置文件的读写操作函数
- PHP获取与操作php.ini文件的几个函数示例
- PHP获取和操作配置文件php.ini的几个函数
- 文件操作的函数
- FileSystem对象常用的文件操作函数有哪些?
- Symbian中操作ini文件
- FSO操作文件的几个小函数(转)
- Linux C 函数参考(文件内容操作)
- Win32汇编教程十三 INI 文件的操作
- 2个读写ini配置文件的函数
- PowerBuilder函数小集(文件操作)
- VC++ 操作 ini 文件
- 大灰狼的ASP工具箱——用ASP读INI配置文件的函数。
- 标准文件操作函数(转载)