[Gdal-dev] Wide-character filenames with GDAL file IO?
Ben Discoe
ben at vterrain.org
Wed Sep 20 02:13:54 EDT 2006
Mateusz,
> -----
> From: Mateusz Loskot
> Sent: Tuesday, September 19, 2006 12:38 PM
>
> > The problem i have _not_ solved is what to do on Windows with code
> > which uses std::ifstream() instead of fopen().
>
> std::ifstream is a type from the C++ library but fopen() is a
> function from the C library.
> I'm not sure I understand what's here to be solved
What's here to be solved is GDAL's source. If it only calls fopen(), then
it can be replaced with the function i described. If GDAL also uses the C++
stream classes for file IO (which i hope it does not), then there exists the
problem i described.
> Simply, you have to decide if you use streams or file
> descriptor, both are different approaches used in different
> languages (C/C++) and are based on different libraries (C/C++).
Obviously. But like many large projects, GDAL is both C and C++, and uses
both standard libraries.
> > MSDN documents that there is a
> > (wchar_t*) version of std::ifstream() constructor
> > (http://msdn2.microsoft.com/en-us/library/zek0beca.aspx),
>
> Simply, there are two specializations of basic_ifstream, one
> for char -> ifstream and one for wchar_t -> wifstream.
There may be, but that's irrelevant. I said two _constructors_, not two
template instances. If that MSDN link works for you, you can see that
std::ifstream<char> has two constructors, one which takes a char*filename,
and one which takes a wchar_t*filename. This is totally independent of the
base type of the template, which has to do with the data read from the
stream, not the charset of the filename used to construct it.
As i mentioned, the MSDN documentation has those two constructors, but the
headers and library that come with MSVC 7.1 do not have both.
> AFAIR there is <fstream> header in C++ library provided with
> Visual C++ 7.1 compiler.
Yes, but the constructor does not take a wchar_t*filename.
-Ben
More information about the Gdal-dev
mailing list