fread + non-english characters
A question.
Consider the code:
Code:
FILE* f = fopen("settings.xml", "r");
char buf[10240];
fread(buf, 10240, 1, f);
fclose(f);
This would be used to read in an entire file. The problem is that when there are international characters, they become all messed up in the reading process.
Also, this is not my code. The tinyxml C++ library reads files this way and obviously it's causing me problems!
So I was wondering what the best way to fix this would be?
Preferably, I don't want to rewrite the tinyxml code, so workarounds are welcome.
As a last resort, I may rewrite parts of it, but then the question would be what the appropriate way to read files with international characters would be?
The file should be in UTF-8 (no leading bytes).