I'm trying to copy a string into a character array to be used in .write(). Here is a bit of my code to show you what I mean:
//input_buffer is a string that is determined during runtime
int length = 5;
char * buffer = new char [input_buffer.size()];
buffer = input_buffer;
ofstream os;
os.open ("test.txt", ios::binary );//FDT_filename[top->a0], ios::binary );
os.write (buffer,length);
I get the following error when I try this:
error: cannot convert ‘std::string’ to ‘char*’ in assignment
Any ideas about how to do this? I realize my notation is likely incorrect.