First the basic question, (I) I'm using the following code, trying to print the 'á' character over the console without much luck (instead it prints a different character).
1 2 3
|
std::wstring temp;
temp = L"á";
std::wcout << temp << endl;
| |
(II) I'm trying to learn how to do this, in order to read a file with characters like the following:
"á, é, í, ó, ú, Á, É, Í, Ó, Ú"
Using code similar to the following, the output is not what I expect it to be over the console.
1 2 3 4 5 6 7 8 9 10 11 12 13
|
std::vector<std::wstring> line;
std::wifstream file("file.txt");
std::wstring temp;
while(!file.eof()) // Store the file in a vector of strings,
{ // where each string represents a line in the text file.
getline(file, temp);
line.push_back(temp);
}
int n = line.size();
for(int i = 0; i < n; i ++)
std::wcout << i+1 << ": " << line[i] << std::endl;
| |
Using this code, doesn't show the characters the way they should be shown.
I'm using the Visual C++ 2008 Express Edition Compiler, and seeing the output on a Windows XP console (is it possible that it has to do with the console).