Re: "File is not a vaild Famitracker Module"
Posted: Sat Feb 17, 2018 12:32 am
Mushroomdude123 wrote:The last time I opened it was just to listen to it. After that, I closed Famitracker then unplugged my flash drive.
The operating system may not have finished writing something, causing the file system to become inconsistent. To keep this from happening again, always unmount the flash drive using "safely remove" before unplugging it.
Now back to the topic of things FamiTracker can do to minimize the impact of surprise removals:
Linux has a system call called fsync() that ensures a file is completely written to the drive. The sequence is
Code: Select all
fflush(outfp); // send end of data from application buffer to the OS
fsync(fileno(outfp)); // send data from the OS to disk
Reportedly, fsync() on Windows is called _commit() and appears to wrap FlushFileBuffers(), and fileno() on Windows is called _fileno().