Reading a file

Hi

I have a problem. I'm trying to read a file and save each character in a vector. The problem is that my file is written in Spanis, then some original characters appears like multiple characters. I need to save this multiple characters in just only one vector's place.

Thank you
your file is using a unicode or wide character formatting. you would have to convert it to an 8 bit character set -- there is a lot of information online about doing that and the pitfalls associated with it. it would be better if you made your vector wide (wchar) instead of char, or used a wide string, than trying to convert it, if that is possible.

Thank you, jonnin, for your help.

char *locale = setlocale(LC_ALL, "");
FILE *in = fopen("datos.txt", "r");

wint_t c;
std::vector<wchar_t> y;
while ((c = fgetwc(in)) != WEOF){
y.push_back(c);
}
fclose(in);

This is the code that I used
Topic archived. No new replies allowed.