Saving a Bitmap to the same filename it was loaded from

Hi,
I am loading a Bitmap file and then changing the EXIF data in it and trying to save it back to the same filename, however this doesnt work.

The Bitmap.save documentation says "Do not save an image to the same stream that was used to construct the image. Doing so might damage the stream.", does this have something to do with my issue?

My code for loading is:
<std::string fullPath = imgFolderPath + "\\" + imageFileNames[i];
std::wstring wstr(fullPath.begin(), fullPath.end());
Bitmap* bitmap = new Bitmap(wstr.c_str());>

and my code for saving is:
<bitmap->Save(wstr.c_str(), &clsid, NULL);>

I am working with.jpgs, if the file path in the saving is different from that of the loading it works just fine, it just refuses to save to the same file.
Is there a way to do this or a work around to do this?
Perhaps. It sounds like the Bitmap object keeps hooks in the file for data (which is a bad idea anyway).

You'll have to save to a different file, close the original file, delete it, and rename the new file the same name as the original.

OR, you could use a different library, like EasyBMP
http://easybmp.sourceforge.net/

Hope this helps.
are you including the following code: GetEncoderClsid(L"image/jpg", &clsid);?
If so than the next step is to step though the code just to see if you are doing what you think you are doing.
You might be doing something like assigning a nullptr somewhere
Topic archived. No new replies allowed.