wchar_t filename support
Brought to you by:
kaalus
I wanted support for wchar_t for rapidxml::file filenames but the pre-existing patch didn't do it for me so I wrote another one. This "supports" other character types as well although it just strips all high bytes off of the characters.
It's "slower than necessary" for type char but we're erroring so that shouldn't be a problem.
template <typename Fn> file(const Fn *filename) { using namespace std; // Open stream basic_ifstream<Ch> stream(filename, ios::binary); if (!stream.good()) { // quick and dirty coersion from wchar_t if that's what Fn is. const Fn* fnend = filename; while (*fnend != 0) ++fnend; throw runtime_error(string("cannot open file ") + string(filename, fnend)); } stream.unsetf(ios::skipws);