Hello everyone,
I am having a hard time reading and writing a UTF-8 file in visual c++ 2010.
void ReadUTF8File()
{
ifstream UTF8File("C:\\DaniWeb\\Desktop\\UTF8File.txt");
/*
UTF8File.txt:
☺☻♥♦♣♠•◘○
*/
string UTF8FileStr;
if(UTF8File.is_open())
{
while(!UTF8File.eof())
{
UTF8File >> UTF8FileStr;
cout << UTF8FileStr << endl;
/*
cout:
☺☻♥♦♣♠•◘○
*/
}
}
UTF8File.close();
}
The output was not similar to the file's text. Please help, thank you for your time and consideration.