This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: wifstream


I see, VC has it's own way of doing things, thank you for advice. One
more question, where can I have reference to standard library?

On 15/08/2014 11:54 AM, Jonathan Wakely wrote:
On 15 August 2014 16:49, ArbolOne wrote:
In my Windows 7 this code doesn't work:
std::wstring& getFileName() {
      return file_name;
}
myMethod(){
wchar_t tmp = *getFileName().c_str() ;
      std::wifstream infile( tmp ); // <<-- error: invalid conversion
from 'wchar_t' to 'const char*' [-fpermissive]
      return infile.good( );
}


It seems to me that  std::wifstream does not accept wchar_t as a value
type, but only const char*, contrary to to what is explained in
http://msdn.microsoft.com/en-us/library/3b5w4311.aspx
That is describing the MS library, it's not the standard.

Where did I go wrong? or, is this a bug?
No, the standard says that basic_fstream always takes narrow character
strings to specify the filename, even if the stream itself uses wide
characters.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]