Acting on the value of EXIF metadata

Jun 1, 2015 at 5:48pm
Hi,

I'm trying to read the DateTaken EXIF tag from an image file, to then have conditionals depend on specifics of the date, such as month, etc. Through searching, I have been able to access and output the value through GDI+ PropertyItems (shown in the code below). This link was helpful to get to that point: https://msdn.microsoft.com/en-us/library/windows/desktop/ms533832(v=vs.85).aspx

However, there doesn't appear to be a way to convert the value to a string, from where I could extract the month individually. Attempting this:
string date = dateTaken->value;
returns an error stating there's no suitable constructor to convert from void* to string. Would there be another way to either convert to a string or have if statements use the date?

Thanks in advance for any help.

GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
Image* image = new Image(L"image.JPG");
UINT size = image->GetPropertyItemSize(PropertyTagExifDTOrig);
PropertyItem* dateTaken = (PropertyItem*)malloc(size);

image->GetPropertyItem(PropertyTagExifDTOrig, size, dateTaken);

printf("Date Taken: %s.\n", dateTaken->value);
Last edited on Jun 1, 2015 at 9:02pm
Jun 2, 2015 at 5:55am
std::string date = static_cast<char*>(dateTaken->value);
Jun 2, 2015 at 8:45am
I see, thanks for the help! I hadn't thought to cast it to char.
Topic archived. No new replies allowed.