Boost logo

Boost :

Subject: Re: [boost] File Handle and FILE* wrappers?
From: Sylvester-Bradley, Gareth (Gareth.Sylvester-Bradley_at_[hidden])
Date: 2014-11-19 07:47:01

On Wed, Nov 19, 2014 at 12:33 PM, Andrey Semashev wrote:
> On Wed, Nov 19, 2014 at 3:16 PM, Olaf van der Spek <ml_at_[hidden]> wrote:
> > Hi,
> >
> > Would there be any interest in wrappers for file handles / descriptors
> > and FILE*?
> >
> > Sometimes one needs native handles or FILE* for interoperability or
> > special features like memory mapped IO, but standard C++ doesn't
> > provide convenient RAII friendly wrappers for these.
> > The idea seems trivial yet quite useful.
> >
> > I'm aware of <boost/iostreams/device/file_descriptor.hpp> but it seems
> > to be too high-level.
> >
> > I've put a simple start for FILE* at
> >
> > What do you think?
> >
> > Also posted at!topic/std-proposals/Q4RdFSZggSE
> shared_ptr/unique_ptr work fine for me with FILE*, one only has to
> write a deleter. A dedicated class would be needed for POSIX file
> descriptors though.

Peter Sommerlad and Andrew L. Sandoval's unique_resource RAII proposal uses both FILE* and POSIX file descriptors as examples.
I think this is the latest revision:


************************************************************************ The information contained in this message or any of its attachments may be confidential and is intended for the exclusive use of the addressee(s). Any disclosure, reproduction, distribution or other dissemination or use of this communication is strictly prohibited without the express permission of the sender. The views expressed in this email are those of the individual and not necessarily those of Sony or Sony affiliated companies. Sony email is for business use only. This email and any response may be monitored by Sony to be in compliance with Sony's global policies and standards

Boost list run by bdawes at, gregod at, cpdaniel at, john at