Microsoft Foundation Class Library for Windows CE
CWinApp::WriteProfileStringThis method writes the specified string into the specified section of the .ini file in the application.
BOOL WriteProfileString(
LPCTSTR lpszSection,
LPCTSTR lpszEntry,
LPCTSTR lpszValue );
Parameters
lpszSection
Points to a null-terminated string that specifies the section containing the entry. If the section does not exist, it is created. The name of the section is case independent; the string may be any combination of uppercase and lowercase letters.
lpszEntry
Points to a null-terminated string that contains the entry into which the value is to be written. If the entry does not exist in the specified section, it is created.
lpszValue
Points to the string to be written. If this parameter is NULL, the entry specified by the lpszEntry parameter is deleted.
Return Value
Nonzero if it is successful; otherwise, it is zero.
Example
CString strSection = "My Section";
CString strStringItem = "My String Item";
CString strIntItem = "My Int Item";
CWinApp* pApp = AfxGetApp();
pApp->WriteProfileString(strSection, strStringItem, "test");
CString strValue;
strValue = pApp->GetProfileString(strSection, strStringItem);
ASSERT(strValue == "test");
pApp->WriteProfileInt(strSection, strIntItem, 1234);
int nValue;
nValue = pApp->GetProfileInt(strSection, strIntItem, 0);
ASSERT(nValue == 1234);
For another example, see the example for CWinApp::GetProfileInt.
Requirements
Windows CE versions: 1.0 and later
Header file: Declared in Afxwin.h
See Also
Partager