Mega Code Archive

 
Categories / Delphi / API
 

Making ini file changes permanent

Question: After writing to a ini file, how can the ini file cache be flushed so the changes made are permanent? Answer: Call the Windows API function WriteProfileString() or WritePrivateProfileString() and pass nil parameters for the section, key, and string values. Example: WriteProfileString(nil, nil, nil); WritePrivateProfileString(nil, nil, nil, FileName);