|
I want to write unsigned long data to a file in binary, knowing the number of bits required for each data (BIT, that is, just writing N bits).
I did this but no data was written.
ifstream in ("test.txt"); // where are the characters
ofstream out;
out.open ("result.xxx", ios :: binary);
int index;
while (! in.eof ())
{
in >> index;
out.write ((char *) (code [index]), code_len [index]);
} |
|