I want my program to take a wchar string from the user and print it to a file,but even though it print the string to the command prompt correctly,when it comes to the file it only prints the ascii characters, any other characters is printed incorrectly.
Example: instead of writing "olá" it prints "ol "
#include <stdio.h>
#include <wchar.h>
#include <locale.h>
int main(){
FILE *pst = fopen("C:\\teste1.txt","a");
wchar_t word[100];
fgetws(word,20,stdin);
fputws(word,stdout);
fputws(word,pst);
fwprintf(pst,word);
return 0;
}