MFC读写配置文件

DWORD WINAPI GetPrivateProfileString(
  __in          LPCTSTR lpAppName,
  __in          LPCTSTR lpKeyName,
  __in          LPCTSTR lpDefault,
  __out         LPTSTR lpReturnedString,
  __in          DWORD nSize,
  __in          LPCTSTR lpFileName
);
DWORD WINAPI GetPrivateProfileSection(
  __in          LPCTSTR lpAppName,
  __out         LPTSTR lpReturnedString,
  __in          DWORD nSize,
  __in          LPCTSTR lpFileName
);

如果文件不存在,会新建文件
BOOL WINAPI WritePrivateProfileString(
  __in          LPCTSTR lpAppName,
  __in          LPCTSTR lpKeyName,
  __in          LPCTSTR lpString,
  __in          LPCTSTR lpFileName
);
BOOL WINAPI WritePrivateProfileSection(
  __in          LPCTSTR lpAppName,
  __in          LPCTSTR lpString,
  __in          LPCTSTR lpFileName
);

原文地址:https://www.cnblogs.com/htys/p/3440928.html