Thursday, March 27, 2014

when fstream doesn't work...

Recently I was bumped into a problem with std::fstream. It doesn't work with Chinese text directory by default. For example when a file is located at a directory with a Chinese characters, fstream cannot read it and calling fail() function returns true.

After trying to search for it, I found a good answer from this link:

So, it's about locale settings, after setting the locale everything runs fine.

Labels: , ,


Post a Comment

<< Home