What I'm trying to do here is to cast a stringbuf
object into an array of char.
I do this to send the array of char to a C
interface which doesn't understand the type std::stringbuf
.
Here's a part of my code to illustrate the problem :
std::stringbuf buffer;
char * data;
//here i fill my buffer with an object
buffer >> Myobject;
//here is the function I want to create but I don't know if it's possible
data = convertToCharArray(buffer);
//here I send my buffer of char to my C interface
sendToCInterface(data);
As Kiroxas suggests in the first comment, try to avoid intermediate variables:
...the less variables the less confusion ;-)