Reputation: 87
I'm trying to read a binary file with fread() function.
I want to read 2 byte every time (UTF-16 file).
The relative code:
char words[2];
while(fread(&words, sizeof(words), 1, sFile))
//do somthing...
The information from the file is stored only in the first place of the array, and the second stay as zero. Any idea? Thanks
Upvotes: 0
Views: 340
Reputation: 87
Thank to you all, I found the mistake -
In UTF-16, every char is 2 byte, and the "regular" chars are with zero in the 2nd byte.
Again, thank you.
Upvotes: 2