add Win32 API Unicode converter, other small changes

Qt Example: add file.close() (consistency between GTK example)
RagePhoto: saveFile() checks for good(), more data() -> c_str()
This commit is contained in:
Syping 2021-11-06 20:17:28 +01:00
parent 85ab850895
commit 05890541dc
6 changed files with 122 additions and 21 deletions

View file

@ -56,18 +56,18 @@ int main(int argc, char *argv[])
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
char photoString[256];
char photoHeader_string[256];
iconv_t iconv_in = iconv_open("UTF-8", "UTF-16LE");
if (iconv_in == (iconv_t)-1)
return -1;
size_t src_s = sizeof(photoHeader);
size_t dst_s = sizeof(photoString);
size_t dst_s = sizeof(photoHeader_string);
char *src = photoHeader;
char *dst = photoString;
char *dst = photoHeader_string;
const size_t ret = iconv(iconv_in, &src, &src_s, &dst, &dst_s);
iconv_close(iconv_in);
if (ret == static_cast<size_t>(-1)) {
return -1;
}
return strcmp(photoString, "PHOTO - 02/01/17 08:42:44");
return strcmp(photoHeader_string, "PHOTO - 02/01/17 08:42:44");
}