Subject: Re: [boost] File Handle and FILE* wrappers?
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2014-11-26 16:21:05
On November 26, 2014 3:57:06 PM EST, Andrey Semashev <andrey.semashev_at_[hidden]> wrote:
>On Wednesday 26 November 2014 20:10:31 Olaf van der Spek wrote:
>> On Thu, Nov 20, 2014 at 9:10 AM, Olaf van der Spek <ml_at_[hidden]>
>> > On Wed, Nov 19, 2014 at 1:47 PM, Sylvester-Bradley, Gareth
>> > <Gareth.Sylvester-Bradley_at_[hidden]> wrote:
>> >>> shared_ptr/unique_ptr work fine for me with FILE*, one only has
>> >>> write a deleter. A dedicated class would be needed for POSIX file
>> >>> descriptors though.
>> >> Peter Sommerlad and Andrew L. Sandoval's unique_resource RAII
>> >> uses both FILE* and POSIX file descriptors as examples. I think
>> >> the latest revision:
>> >> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4189.pdf
>> > It does solve the RAII part but it doesn't provide a standard
>> > interface for native IO.
>> Does noone use native IO?
>I do, from time to time. But I always found RAII wrappers sufficient
>the native API to work with file descriptors. I usually need something
>low-level or non-portable anyway when I do
I use filesystem or IOStreams when I want portability, and otherwise use RAII and native APIs when the code isn't portable.
(Sent from my portable computation engine)