saving a CString to binary file with trailing spaces
Heres what i want to happen except i want it to happen with a CString instead of a char []:
Code:
char name[10] = "Bob ";
ofstream fout(filename, ios::binary);
fout.write(name, sizeof(name));
fout.close();
the output has 'Bob .' (with the trailing spaces).
when i try this with CString it give me 'Bob.......' (with null's instead of spaces)
I know that CString doesn't have the trailing spaces and is only 'Bob'.
How do i either tell CString to be 10 spaces no matter what, or copy CString to Char[10] and have the spaces, or some other way of fixing it ;-)