Hi!
I am using 2-byte wide char strings in my application. Strings should be written and read from file (in flash FS). When using fwprintf(), i got in file only one byte per character, like converting UTF-8 to plain ASCII.
Here's my simple example:
int write_setup(DEVICE *bt_s) { FILE *fout; fout = fopen (INI_FILE,"w"); if (fout != NULL) { fwprintf (fout, L"NAME=%ls\n", bt_s->name); fclose (fout); return 0; } else return -1; }
When I call this function, the bt_s->name points to memory with following contents:
0x54 0x00 0x65 0x00 0x73 0x00 0x74 0x00 or in ascii: T<0>e<0>s<0>t<0>
when I check the file contents (with file hex editor), the ontents is plain ascii, one byte per character: 0x54 0x65 0x73 0x74, which is "Test"
Is this compiler related issue on using wide characters? What is proper use on file-wirting (and reading) wchar_t strings ?
Thanks!
Marko