#define _POSIX_C_SOURCE 2 #include #include #include "gramscii.h" /*** File management ***/ void write_file(FILE *fc){ FILE *fout; int i, ne; if (!fname[0] || force_new){ get_string(fc, "Write to: ", fname, 255); if ((fout=fopen(fname, "r"))!=NULL){ if (!is_yes(get_key(fc,"File exists. Overwrite [y/n]?")) ){ fclose(fout); return; } fclose(fout); } } if((fout=fopen(fname, "w"))==NULL){ get_key(fc, "Error opening file."); return; } ne = 0; for (i=0; i