I have an c++ program that should read a text from a file named "Pontaje.txt" and store it into a string. The problem is that in that file is an special character and the program can't use it properly.
Pontaje.txt
[604] Dumy | 17501 — Today at 12:01 AM
Note that "—"(is a special character) is not "-"(from the keyboard)
main.cpp
#include <iostream>
#include <string>
#include <fstream>
int main()
{
std::ifstream test("Pontaje.txt");
std::string test2;
std::getline(test, test2);
std::cout << test2;
}
Output:
[604] Dumy | 17501 — Today at 12:01 AM
How can I assign in test2 that line properly?
Note that I've tried using std::wifstream
, std::wstring
and std::wcout
but i get the same result