This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: [Mingw-w64-public] Windows/MinGW extension: opening std::fstream with a wstring/wchar_t*


> 2011/6/26 Sam Morris <sam@robots.org.uk>:
> > FYI, I think you can do this without modifying the fstream like this:
> >
> > __gnu_cxx::stdio_filebuf b (_wopen (L"filename", _O_RDONLY));
> > std::istream i (&b);
> >
> > The stdio_filebuf will close the file when it's done.
> >
> > stdio_filebuf can also be constructed given a FILE* argument, which lets
> > you open the file with _wfopen; however in this case it won't close the
> > FILE* when it is destroyed.
> 
> Let me start by saying I mean no offence ;-) __gnu_cxx hacks is
> exactly what I'm trying to avoid. I think my idea has true added value
> due to it also being in "the other big STL" for the Windows platform
> (If it is liked here, I see no reason not to also propose it to LLVM's
> libc++).

Oh, yes, definitely. I would love to see fstream extended to take a
wchar_t path on Windows as then I can move away from relying on the
__gnu_cxx::stdio_filebuf class. :)

> Ruben

-- 
Sam Morris <https://robots.org.uk/>
3412 EA18 1277 354B 991B  C869 B219 7FDB 5EA0 1078

Attachment: signature.asc
Description: This is a digitally signed message part


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