I have a text file (ANSI) that contains accent characters, for example:
A
àà
ééc
I'm unable get the accent characters to show and to manipulate with.
This is my code:
ifstream readfile(argv[1]); // to read a text file
string output;
while (!readfile.eof())
{
getline(readfile, output);
const char *p = output.c_str();
while (*p != '\0')
{
//Some of my codes here for manipulation, comparison...
cout << *p++;
}
cout << endl;
}
I did some research and I also tried wcout, wifstream, wstring, wchar_t, but they don't seem to work... I also notice the "getline" is unable to read accent characters.
With a text file without any accent characters, my current code works perfectly.
When there is an accent character, it shows a strange character instead and because of that, I'm unable to do some manipulation.
EDIT:
With const char *p, I'm unable to assign the accent characters to do comparisons in the program itself.
What I'm really trying to do is getting the accent characters from the text file, and then do some comparison inside the program/code, and when the comparison is over, it writes the correct output in a new text file.
The input and output text files show the correct accent characters. The real issue is I want to compare the accent characters in the program/code itself.
EDIT2:
For example,
My input for the const char *p is "à". In my program, I use the p (which is "à", but it shows ▒ instead) to compare "à", the result is suppose to be true, but it gives me false.
"à" compare with "à" should be true.
but in my program, instead, it's
"▒" compare with "à", and it's false.