diff --git a/ba/ba2200.cpp b/ba/ba2200.cpp index 9dfab878a..a2936fc5c 100755 --- a/ba/ba2200.cpp +++ b/ba/ba2200.cpp @@ -183,6 +183,7 @@ bool TArchive::fsplit(const char* filename, char floppy, const char* desc) const setvbuf(i, NULL, _IOFBF, BUFSIZE); const long tot = fsize(i); + long scritti=0; TFilename work; work << floppy << ":/" << from.name(); // File su dischetto @@ -204,8 +205,14 @@ bool TArchive::fsplit(const char* filename, char floppy, const char* desc) const ok = FALSE; if (!ok) - { - if (o != NULL) fclose(o); + { + + if (o != NULL) + { + chsize(fileno(o),scritti); // Must truncate output file or some information will be rewritten on next disk! + scritti = 0; // Reset count bytes written to disk. + fclose(o); + } o = ask_disk(work, ++disk, floppy, FALSE); ok = o != NULL; if (ok) @@ -240,9 +247,12 @@ bool TArchive::fsplit(const char* filename, char floppy, const char* desc) const ok = (letti > 0) ? (fwrite((char*)(const char*)buffer, letti, 1, o) == 1) : TRUE; if (!ok) error_box("Impossibile scrivere i dati sul dischetto"); + else + scritti +=letti; } } - + else + scritti += letti; w.addstatus(letti); if (ok) ok = !w.iscancelled();