public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: ArbolOne <ArbolOne@hotmail.ca>
To: gcc-help@gcc.gnu.org
Subject: Re: wifstream
Date: Fri, 15 Aug 2014 19:40:00 -0000	[thread overview]
Message-ID: <BLU436-SMTP2387274BE3A7626ED7795E7BAE90@phx.gbl> (raw)
In-Reply-To: <CAH6eHdRvtnFjpLWFAmS-jpJrKVax5YoM4ONknOZEPH_5-gAOCg@mail.gmail.com>

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.

  reply	other threads:[~2014-08-15 19:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-15 15:49 wifstream ArbolOne
2014-08-15 15:54 ` wifstream Jonathan Wakely
2014-08-15 19:40   ` ArbolOne [this message]
2014-08-15 20:36     ` wifstream Oleg Endo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BLU436-SMTP2387274BE3A7626ED7795E7BAE90@phx.gbl \
    --to=arbolone@hotmail.ca \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).