Hi,

I have tried to open the file with _wfopen(), pass it to  __gnu_cxx::
stdio_filebuf<char>, and set it as the buffer of an std::istream.
The file is open properly, first bytes are OK, but after 263 read bytes I
get an eof(), while the file is 39MB large.

Reading works well with a standard std::ifstream and a non-unicode file
name, and I am testing the simplest way possible:

        int i = 0;

        while(!stream.eof())

        {

                char a;

                stream.read(&a, 1);

                i++;

        }

        info("%d",i);


If nobody has an idea, I will give up for a Qt-based solution but I
was hoping making a source code that would compile without any
external library (with some preprocessing for detecting the Windows
case)

Thanks,

Etienne


2015-06-19 16:59 GMT+02:00 Ruben Van Boxem <vanboxem.ru...@gmail.com>:

> 2015-06-19 16:56 GMT+02:00 Ruben Van Boxem <vanboxem.ru...@gmail.com>:
>
>> 2015-06-19 16:45 GMT+02:00 Etienne Sandré-Chardonnal <
>> etienne.san...@m4x.org>:
>>
>>> Dear all
>>>
>>> I have found this old gcc discussion from Ruben :
>>> http://gcc.gnu.org/ml/libstdc++/2011-06/msg00066.html
>>>
>>> Is this available in recent mingw releases? I cannot find any of these
>>> extensions in 4.9.2 headers (and it does not work)
>>>
>>
>> No, unfortunately, it is not. You must manually work around this
>> shortcoming by e.g. using the libstdc++ extension:
>> https://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_io.html
>> Note that proper memory management is kind of tricky (you need to take
>> care of the file descriptor or FILE* yourself)
>>
>
> Correction: onl the FILE* if you use that constructor. File descriptors
> are handled by the stdio_filebuf destructor.
> See: https://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00070.html
>
>>
>> Ruben
>>
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to