Strange ostream problem

Hello all

I have a little strange problem with printing bytes to an ostream.
I got the following Method for printing a byte:

1
2
3
4
5
6
ostream& write_byte(ostream& out, BYTE value) {
	for (unsigned size = sizeof(BYTE); size; --size, value >>= 8) {
		out.put( static_cast <char> (value & 0xFF) );
	}
	return out;
}


This works well for all values exept 10. If I try to print the decimal
10 or 0x0A to a file via an ofstream there suddenly appears the hex number
0x0D0A instead of 0x0A.

I'm really confused about that, please help :P

Greetings
Your ostream must be opened in binary mode.
aaah
i knew it was that easy
thank you very much
Topic archived. No new replies allowed.