I want to output wide characters to a file, and fwprintf
doesn't do it, even though it's described as doing just that. Sample code:
const char *testFileName = "/Users/jdmuys/wideTestFile.txt";
FILE *wideTestFile;
wideTestFile = fopen(testFileName, "w");
fwide(wideTestFile, 1);
fwprintf(wideTestFile, L"12345");
fclose(wideTestFile);
After which my file "wideTestFile.txt" contains precisely 5 bytes: 31 32 33 34 35
according to my hex dump utility.
I suspect some issue with the current locale, as perhaps fwprintf
calls upon fwprintf_l
, which takes a locale as an additional argument.
I have been reading on how use that last call, but I can't manage to understand what I need to pass as a locale. The documentation is rather obscure on that (or perhaps I fail to understand it).
Any explanation why fwprintf
doesn't behave as documented? and any example of use for fwprintf_l
?
Many thanks,
JD
This is with Xcode 4.5.1 under Mac OS X 10.8.2 targetting iOS 6.0 from Objective-C code. But none of that should really matter.