I have a .txt with Kanji and Roman letters, I need to extract each character and check if it is a kanji or not (and if it is, compare it with other kanji), so far I can already evaluate if a character is a kanji or not, using
std::stringstream hexchar;
hexchar << std::hex << int(cc);
std::string mystr = "0x" + hexchar.str();
if (std::stoll(mystr, 0, 16) > std::stoll("0x3040", 0, 16)){
.... IS KANJI ....
}
else
.... ISN'T KANJI ....
The problem I'm having is getting the character from my text file, it is a normal .txt that uses ANSI, so far with this...
std::wifstream f("sample.txt");
wchar_t cc;
while (f >> cc) {
std::wcout << cc;
...I can get the first roman letters but as soon as it stumbles with a kanji it interprets everything after it as an empty char ''
How can I read from my file?
Aucun commentaire:
Enregistrer un commentaire