I want to use <<
operator to fill an external buffer,
I have tried to inherit from iostream
, and then every time I use <<
to my class, I copy the content, into the current buffer location, and increment the buffer location...
I had no luck, I looked into some online examples or tutorials, but I am kinda lost. how can I use a class, and overload <<
operator, to copy variables of type T into the buffer??
Any direction?
An overview of the class I had:
class CBufferedMem
{
public:
CBufferedMem(unsigned char* buffer, unsigned int size);
char ReadFromBuffer(void* dst, unsigned char length);
char writeToBuffer(void src, unsigned char length);
private:
unsigned char* buffer;
unsigned short buffSize;
unsigned char* currentTmpLocation;
unsigned char* endOfBuffer;
};