hey, I've been having this odd problem when I write a file byte by byte,
when I write a byte (dec)10 it adds a (dec)13 in front of it, and as far as I can tell, this is the only byte value that does this.
and most annoyingly, I can't read that (dec)13 with fstream, the only reason I know it's adds it, is because I used an external hex editor.
here is the code that causes the problem:
but the output file reads '0D 0A' (that's in hex, '13 10' in decimal) when viewed in a hex editor.
no other number (that I've tried) adds that extra 13.
any Idea's why this is?
when I write a byte (dec)10 it adds a (dec)13 in front of it, and as far as I can tell, this is the only byte value that does this.
and most annoyingly, I can't read that (dec)13 with fstream, the only reason I know it's adds it, is because I used an external hex editor.
here is the code that causes the problem:
Code:
#include <fstream>
using namespace std;
int main()
{
ofstream MyImage; // ofstream is for editing, ifstream is for reading.
MyImage.open (L"messup.txt");
MyImage << (char)10;
MyImage.close();
return 0;
}
no other number (that I've tried) adds that extra 13.
any Idea's why this is?