Thursday, June 04, 2009

Garbage characters in files

A friend of mine here at LUMS just told me of an issue he had last night. I thought I'd blog it down just in case someone else would tumble upon it.

His C++ program was writing to a file. While debugging the program, the file contained what he expected. But when the program closed, the file contained some garbage characters near the beginning before the meaningful data. He discovered that it was because he had opened the same file in the program twice.

No comments: