This should be a really easy question to answer. I'm trying to output binary data to a file using write. Its works ok when I open the file and do the desired output write within one method. However when I try to pass a pointer to the file and use separate methods I get a compile error.
test code is shown below...
void writeout(ostream *ofile_ptr);
ofstream outfile("frame.data", ios::out | ios::binary);
ostream *p = &outfile;
void writeout(ostream *ofile_ptr)
short int buffer=65535;
ofile_ptr.write((char *)(&buffer), 2);
This is the compile error (gcc used)
In function `void writeout (ostream *)':
btestout.cpp:15: request for member `write' in `ofile_ptr', which is of
non-aggregate type `ostream *'
thanks in advance.