I have a jpeg image in the char [] buffer in memory, all I have to do is write it to disk exactly the same as it is. I'm doing it now
ofstream ofs; ofs.open(filename); ofs.write(buffer, bufferLen); ofs.close();
but the image doesnโt work out right, it looks distorted by random black and white stripes everywhere. After comparing the image with the original in hex view, I found out that thestream changes the data when it thinks I'm writing a newline character. In any case, when 0x0A is displayed in the original, thestream writes as two bytes: 0x0D0A. I have to assume that thestream intends to convert from LF to CRLF only, is there a standard way to make it not do this?
c ++ file-io visual-studio
Graphics Noob
source share