Re: wifstream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux