From the serial camera to get an image of the JPEG data, I copied the data to TXT document, want to change the data into an image, in VC + + should do? Read some information, some people said to save directly to JPG format, so I changed the filename suffix. txt to. jpg, but "no preview" is displayed when it is opened. I have implemented the following programs in VC + +:
FILE *pfile=fopen ("Tst.txt","RB");//tst.txt for JPEG data Char*Pbuf;fseek (PFile,0, seek_end);intlen=Ftell (pFile);p buf=New Char[len+1];rewind (pFile); Fread (PBuf,1, Len,pfile);p Buf[len]=0; fclose (pFile); FILE*pfilep=fopen ("tst1.jpg","WB");//write in binary mode, tst1.jpg to the picture file to be savedfwrite (PBuf,1, Len,pfilep); fclose (PFILEP); MessageBox ("Finish writing!");
But the result is "no preview". Do not know how to do good, please elder brother eldest sister master help pointing, Brother grateful Ah!
has been resolved, because the format is not written correctly, thank you very much for your help!
The serial camera got the JPEG data of an image, I copied the data to TXT document, I want to change the data into an image