Some time ago, I wrote a program that used the write() function of an fstream object to write a large file to a 100MB-zip-disk (it was an old computer). When I "End Now"ed the program I found that the zip disk was corrupted. The file didn't show up but a lot of the free space was gone, and I had to format the disk.
I'm guessing it was because the close() function was never called, and so the result would have been the same if I had run the program on my hard drive (which I'm glad I didn't). Is there any way of getting around this problem?
I know there's an atexit() function, but I tried it with cout and it crashed.
Thanks for your time