Hello, I have been stuck on this for hours no jokeI am a guy who is a noob when it comes to C + +.
i want to transfer bitmap data into a char/string/stream (any of the above) buffer, but it doesn't work.
What does work is writing the data to a file like this:
fwrite(&BmHdr,sizeof(BITMAPFILEHEADER),1,myfile);
BmHdr is a BITMAPFILEHEADER
But, I want to write it into a chair,string,or stream, so I have tried:
memcpy(Buffer,&BmHdr,Length);
(buffer being an unsigned char)
when doing this, the first few things are as it should be (it shows like bm1/2)
but it chops it off there, when it should have 14 characters (bm1/2 , then some nulls and another character).
The Length parameter doesn't seem to be the problem.
One of the many other things I've tried include:
-trying to transfer into a stringstream (same/similar problem)
-setbuf() - trying to redirect the fwrite output, which works, into a buffer, which doesnt work
Thanks, and any help would be greatly appreciated



3Likes
LinkBack URL
About LinkBacks
I am a guy who is a noob when it comes to C + +. 


