easy; all you need is to allocate backbuffer
and write to it;
char *backbuffer;
...
backbuffer = (char*) malloc (64000);
...
*(backbuffer + x + y*320) = color;
(assuming 320x200x256 mode)
However, copying this to video memory is a bit trickier. As I don't have my sources nearby right now, I suggest that you check help (hmm... RHIDE's help will do nicely), function that could do the job is _dosmemput or something like that. You will need video memory's base address (0xa0000 - note 4 0's!) and it's size (64000 bytes) in addition of backbuffer address.
Of course, this isn't fastests possible way to do flipping, but faster methods are even trickier...