WritePrivateProfileSection()
プライベートなiniファイルを書き込む際に、"Key=値"の文字列の終端には"\0\0"である必要があるそうです。
TCHAR crntPath[1024]; // カレントパス+iniファイルのパス名 BOOL SaveIniFile(void) { TCHAR strBuf[NUM_MAXBUF]; int length; // 『Key=値の末端は、"\0\0"で表すためNULL(\0)詰めしておく』そうです。 if ((length = _stprintf_s(strBuf, NUM_MAXBUF, _T("%s=%d"), iniKeyName.dayByPage, setting.dayByPage)) < 0) { return FALSE; } if (length < NUM_MAXBUF) strBuf[length+1] = _T('\0'); else return FALSE; WritePrivateProfileSection(iniSettName, strBuf, crntPath); return TRUE; }