| 57 | } |
| 58 | |
| 59 | int FHistory::Prepend_save(const std::string &newfile) { |
| 60 | if (!fname.empty()) { |
| 61 | FILE *f; |
| 62 | #ifdef _WIN32 |
| 63 | errno_t e; |
| 64 | |
| 65 | e = fopen_s(&f, fname.c_str(), "w"); |
| 66 | #else |
| 67 | f = fopen(fname.c_str(), "w"); |
| 68 | #endif |
| 69 | |
| 70 | if (f) { |
| 71 | int i; |
| 72 | |
| 73 | fprintf(f, "%s\n", newfile.c_str()); |
| 74 | for (i = 0; i < count; i++) { |
| 75 | // Don't create duplicate entries, so check each one against the newfile |
| 76 | if (strcmp(newfile.c_str(), history[i])) { |
| 77 | fprintf(f, "%s\n", history[i]); |
| 78 | } |
| 79 | } |
| 80 | fclose(f); |
| 81 | |
| 82 | Load(); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | return 0; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Only displays the tail end of the filename path, where |