writer << reader.rdbuf(); What next?
Quote:
Originally Posted by hk_mp5kpdw
Code:
[/
ifstream reader("C:\\windows\\desktop\\1.jpg", ios::in | ios::binary);
ofstream writer("C:\\windows\\desktop\\1_out.jpg", ios::out | ios::binary);
if(reader.fail())
{cout << "Failed to open file" << endl; return 1;}
if(writer.fail())
{cout << "Failed to open write stream" << endl; return 1;}
// Copies entire contents of reader stream into writer stream
writer << reader.rdbuf();
Thanks for this - this has helped me out!
I am trying to create my own "file format". My application can save two bitmaps into one file, with some "ini" settings at the top of the file e.g.:
[BEGININI]
COLOR=RED;
TEXT='SaveMyText'
[ENDINI]
[FILE1]
BMP BINARY CONTENTS HERE
[ENDFILE1]
BMP BINARY CONTENTS HERE
[FILE2]
[ENDFILE2]
I used your code above to create this file but do you know how I could parse the images back and display them?
Any help would be appreciated - thanks!