Open Rails

NativeMethods.WritePrivateProfileString Method

[This is preliminary documentation and subject to change.]

Copies a string into the specified section of an initialization file.

[PreserveSig]
[DllImport(EntryPoint=""WritePrivateProfileString"", CharSet=CharSet.Unicode, SetLastError=True, ExactSpelling=False, PreserveSig=True, CallingConvention=CallingConvention.Winapi, BestFitMapping=False, ThrowOnUnmappableChar=False, Value=""kernel32.dll"")]
public static int WritePrivateProfileString(
   string sectionName,
   string keyName,
   string value,
   string fileName
);

Parameters

sectionName
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.
keyName
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.
value
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.
fileName
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, call GetLastError.

See Also

NativeMethods Class | ORTS.Common Namespace