GetPrivateProfileString &&WritePrivateProfileString 调用系统读写
来源:互联网 发布:h3c1024交换机端口镜像 编辑:程序博客网 时间:2024/05/17 14:15
GetPrivateProfileString Function
Retrieves a string from the specified section in an initialization file.
Note This function is provided only for compatibility with 16-bit Windows-based applications. Applications should store initialization information in the registry.
DWORD WINAPI GetPrivateProfileString( __in LPCTSTR lpAppName, __in LPCTSTR lpKeyName, __in LPCTSTR lpDefault, __out LPTSTR lpReturnedString, __in DWORD nSize, __in LPCTSTR lpFileName);
Parameters
- 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.
- 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.
- 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, "".
Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.
Windows Me/98/95: Although lpDefault is declared as a constant parameter, the system strips any trailing blanks by inserting a null character into the lpDefault string before copying it to the lpReturnedString buffer.
- lpReturnedString
A pointer to the buffer that receives the retrieved string.
Windows Me/98/95: The string cannot contain control characters (character code less than 32). Strings containing control characters may be truncated.
- nSize
The size of the buffer pointed to by the lpReturnedString parameter, in characters.
- 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.
Return Value
The return value is the number of characters copied to the buffer, not including the terminating null character.
If neither lpAppName nor lpKeyName is NULL and the supplied destination buffer is too small to hold the requested string, the string is truncated and followed by a null character, and the return value is equal to nSize minus one.
If either lpAppName or lpKeyName is NULL and the supplied destination buffer is too small to hold all the strings, the last string is truncated and followed by two null characters. In this case, the return value is equal to nSize minus two.
WritePrivateProfileString Function
Copies a string into the specified section of an initialization file.
Note This function is provided only for compatibility with 16-bit versions of Windows. Applications should store initialization information in the registry.
BOOL WINAPI WritePrivateProfileString( __in LPCTSTR lpAppName, __in LPCTSTR lpKeyName, __in LPCTSTR lpString, __in LPCTSTR lpFileName);
Parameters
- 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.
- 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.
- 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.
Windows Me/98/95: The system does not support the use of the TAB (\t) character as part of this parameter.
- 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.
Return Value
If the function successfully copies the string to the initialization file, the return value is nonzero.
If the function fails, or if it flushes the cached version of the most recently accessed initialization file, the return value is zero. To get extended error information, callGetLastError.
Remarks
A section in the initialization file must have the following form:
[section]key=string . . .
If the lpFileName parameter does not contain a full path and file name for the file, WritePrivateProfileString searches the Windows directory for the file. If the file does not exist, this function creates the file in the Windows directory.
If lpFileName contains a full path and file name and the file does not exist, WritePrivateProfileString creates the file. The specified directory must already exist.
The system keeps a cached version of the most recent registry file mapping to improve performance. If all parameters are NULL, the function flushes the cache. While the system is editing the cached version of the file, processes that edit the file itself will use the original file until the cache has been cleared.
The system maps most .ini file references to the registry, using the mapping defined under the following registry key:
- GetPrivateProfileString &&WritePrivateProfileString 调用系统读写
- 利用GetPrivateProfileString/WritePrivateProfileString读写配置文件(.ini)
- C++读写ini配置文件GetPrivateProfileString()&WritePrivateProfileString()
- VB.net GetPrivateProfileString WritePrivateProfileString 读写INI
- WritePrivateProfileString和GetPrivateProfileString读写ini配置文件
- 利用WritePrivateProfileString和GetPrivateProfileString读写配置文件.ini
- MFC读写ini配置文件(WritePrivateProfileString,GetPrivateProfileString,GetPrivateProfileInt)
- C#操作INI文件(调用WindowsAPI函数WritePrivateProfileString,GetPrivateProfileString)
- C#操作INI文件(调用WindowsAPI函数:WritePrivateProfileString,GetPrivateProfileString)
- GetPrivateProfileString ,WritePrivateProfileString详解
- GetPrivateProfileString ,WritePrivateProfileString详解
- c++配置文件ini---GetPrivateProfileString(...)\WritePrivateProfileString(...)
- c++ stl实现对配置文件的读写 根据windows API WritePrivateProfileString,GetPrivateProfileString简单改写
- INI文件编程,WINAPI函数WritePrivateProfileString,GetPrivateProfileString
- 基于QT实现WritePrivateProfileString和GetPrivateProfileString
- INI文件编程,WINAPI函数WritePrivateProfileString,GetPrivateProfileString
- INI文件编程,WINAPI函数WritePrivateProfileString,GetPrivateProfileString
- INI文件编程,WINAPI函数WritePrivateProfileString,GetPrivateProfileString
- Android:View Animition 两种实现方式
- 布同:网络服务器的结构设计
- 第一天
- 解决VS更新/增加服务引用出现“XML 文档中有错误。 读取 XML 数据时,超出最大名称表字符计数配额 (16384)”
- 观察者模式
- GetPrivateProfileString &&WritePrivateProfileString 调用系统读写
- 驱动中的调试方法
- LaTeX添加包
- 163编辑器 自适应宽度 +更改高度
- learning v$ view-> v$process
- 得到占用指定dll的进程
- Java的类(class)、包(package)和接口(interface)
- x=x+1,x+=1,x++的区别
- tomcat 用户权限配置