i am completely baffled at this problem. what i want to do is simple (well, this one part anyways. the problem is part of a much bigger project), i want to open one file that already exists. i want to create a blank file that whose name is the name of the existing one, but with a 2 on the end. i want to read one character from the existing file, and write it to the new one. i want to do this for every byte in the existing file. this works until about the 90th character, whereupon the output file either has null terminators for the rest of the file, or a random character. my code is simple, and as follows:
well, when one looks at it in notepad, it is simply gibberish mixed in with file paths. i simply copied a random file from the "My documents" folder, and renamed it. when comparing the two files after a run, the original seems to have some semblance of data, while the copy has about one line of identical characters, and then one single character repeated until the end.
I had a similar problem. I noticed that characters from the extended ASCII set don't play nice with the C++ and C standard libraries. My suggestion would be to look at another library for your IO needs.
I've noticed that it doesn't have to be null characters. Atleast in my case when I debugged it the values that always stopped the program were null characters and characters that evaluated to negative numbers in the ASCII set. This means that there are UNICODE values in the file that are causing problems.
an old open office document, so yes, not human readable character-wise. i would have thought that any file would be stored byte by byte, so encoding would not matter if all i cared about was that the data got from one place to another, not caring about content.