I have a JPEG file in a char* buffer
from a jpeg encoder. Assume if I write it correctly to file it'll be pic.jpg. Say then I read in using ifstream
from pic.jpg and store it in char* buffer2
.
What's the difference between these two buffers, if there's any?
(The reason I'm asking is that, I have jpeg file in a char * buffer
from a jpeg decoder and I need to write it to disk. But using the system file descripter
and write()
method in fcntl.h
doesn't write it out properly... I can open the picture, but it's very obvious that the colors are off. Please assume that the picture has valid colors when it was outputed from the decoder, because I can write directly from decoder to disk and everything's fine. It's just I need to put it in a char* buffer
for other purposes, and I need to verify that buffer
has valid data before further processing.)