If you have ever needed to remove a section completely from an INI file.
We can use WritePrivateProfileStruct API to achieve this. We have to set NULL as the 2nd parameter to delete a section completely and set NULL as the 3rd parameter to delete a particular key only.
void DeleteSectionFromIniFile() { WritePrivateProfileStruct(_T("Section 1"), NULL, NULL, 0, _T("C:\\test.ini")); }
WritePrivateProfileString too use for the same purpose.