|
|
| version 1.4, 2003/11/03 10:19:43 | version 1.5, 2003/11/05 17:58:01 |
|---|---|
| Line 226 static void iniwrsetarg8(char *work, int | Line 226 static void iniwrsetarg8(char *work, int |
| } | } |
| void ini_write(const char *path, const char *title, | void ini_write(const char *path, const char *title, |
| const INITBL *tbl, UINT count) { | const INITBL *tbl, UINT count, BOOL create) { |
| FILEH fh; | FILEH fh; |
| const INITBL *p; | const INITBL *p; |
| Line 234 const INITBL *pterm; | Line 234 const INITBL *pterm; |
| BOOL set; | BOOL set; |
| char work[512]; | char work[512]; |
| fh = file_create(path); | fh = FILEH_INVALID; |
| if (!create) { | |
| fh = file_open(path); | |
| if (fh != FILEH_INVALID) { | |
| file_seek(fh, 0, FSEEK_END); | |
| } | |
| } | |
| if (fh == FILEH_INVALID) { | |
| fh = file_create(path); | |
| } | |
| if (fh == FILEH_INVALID) { | if (fh == FILEH_INVALID) { |
| return; | return; |
| } | } |
| milstr_ncpy(work, "[", sizeof(work)); | milstr_ncpy(work, "[", sizeof(work)); |
| milstr_ncat(work, title, sizeof(work)); | milstr_ncat(work, title, sizeof(work)); |
| milstr_ncat(work, "]\r\n", sizeof(work)); | milstr_ncat(work, "]\r", sizeof(work)); |
| file_write(fh, work, strlen(work)); | file_write(fh, work, strlen(work)); |
| p = tbl; | p = tbl; |
| Line 306 const INITBL *pterm; | Line 315 const INITBL *pterm; |
| file_write(fh, p->item, strlen(p->item)); | file_write(fh, p->item, strlen(p->item)); |
| file_write(fh, " = ", 3); | file_write(fh, " = ", 3); |
| file_write(fh, work, strlen(work)); | file_write(fh, work, strlen(work)); |
| file_write(fh, "\r\n", 2); | file_write(fh, "\r", 1); |
| } | } |
| p++; | p++; |
| } | } |
| Line 397 void initload(void) { | Line 406 void initload(void) { |
| char path[MAX_PATH]; | char path[MAX_PATH]; |
| milstr_ncpy(path, file_getcd(inifile), sizeof(path)); | file_cpyname(path, file_getcd(inifile), sizeof(path)); |
| ini_read(path, ini_title, iniitem, INIITEMS); | ini_read(path, ini_title, iniitem, INIITEMS); |
| } | } |
| Line 405 void initsave(void) { | Line 414 void initsave(void) { |
| char path[MAX_PATH]; | char path[MAX_PATH]; |
| milstr_ncpy(path, file_getcd(inifile), sizeof(path)); | file_cpyname(path, file_getcd(inifile), sizeof(path)); |
| ini_write(path, ini_title, iniitem, INIITEMS); | ini_write(path, ini_title, iniitem, INIITEMS, TRUE); |
| } | } |