Sry, Syntax:
BOOL WritePrivateProfileString(
LPCTSTR lpszSection, // address of section name
LPCTSTR lpszKey, // address of key name
LPCTSTR lpszString, // address of string to add
LPCTSTR lpszFile // address of initialization filename
);
Parameters
lpszSection
Points to a null-terminated string containing 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.
lpszKey
Points to the null-terminated string containing 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.
lpszString
Points to a null-terminated string to be written to the file. If this parameter is NULL, the key pointed to by the lpszKey parameter is deleted.
Windows 95: This platform does not support the use of the TAB (\t) character as part of this parameter.
lpszFile
Points to a null-terminated string that names the initialization file.
Return Value
If the function successfully copies the string to the initialization file, the return value is TRUE.
If the function fails, or if it flushes the cached version of the most recently accessed initialization file, the return value is FALSE. To get extended error information, call GetLastError.
DWORD GetPrivateProfileString(
LPCTSTR lpAppName, // points to section name
LPCTSTR lpKeyName, // points to key name
LPCTSTR lpDefault, // points to default string
LPTSTR lpReturnedString, // points to destination buffer
DWORD nSize, // size of destination buffer
LPCTSTR lpFileName // points to initialization filename
);
Parameters
lpAppName
Points to a null-terminated string that specifies 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
Points to the null-terminated string containing the key name 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
Points to a null-terminated string that specifies the default value for the given key if the key cannot be found in the initialization file. This parameter cannot be NULL.
lpReturnedString
Points to the buffer that receives the retrieved string.
nSize
Specifies the size, in characters, of the buffer pointed to by the lpReturnedString parameter.
lpFileName
Points to a null-terminated string that names the initialization file. If this parameter does not contain a full path to the file, Windows searches for the file in the Windows directory.
Return Value
If the function succeeds, 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.
Sehr Knapp gehalten (keine
Fehlerkontrolle etc.)
Im Borland als Windows Konsolenanwendung
Compiliert.
#include
int main()
{
char test[256];
WritePrivateProfileString(„Section“,„Key“,„Item“,„c:\Test.ini“);
GetPrivateProfileString(„Section“,„Key“,"
",test,256,„c:\Test.ini“);
MessageBox(NULL,test,„Das ists
hier:“,NULL);
}
Gruß
Dann mal vielen Dank.
Bin mal gespannt darauf.
Viele Grüße
Christian Hund