Michele De Stefano's C++ Utilities
cfile_stream.hpp File Reference

Contains some Boost.Iostreams devices to use a C FILE* as a C++ std::stream. More...

#include <mds_utils/file_utils/detail/cfile_device_base.hpp>

Go to the source code of this file.

Classes

struct  mds_utils::file_utils::cFile_Source
 Source device for FILE* pointers. More...
 
struct  mds_utils::file_utils::cFile_Sink
 Sink device for FILE* pointers. More...
 
struct  mds_utils::file_utils::cFile_Device
 Device for FILE* pointers. More...
 

Namespaces

 mds_utils
 Main namespace of all Michele De Stefano's C++ utilities.
 
 mds_utils::file_utils
 Namespace of all Michele De Stefano's C++ file utilities.
 

Detailed Description

Contains some Boost.Iostreams devices to use a C FILE* as a C++ std::stream.

Imagine this situation: you have some C functions that take a FILE* as input argument. Now you don't want to use the old C FILE* anymore, and you want to write C++ code only. So, basically, you want to use C++ streams only. You would like to make FILE* behave like a C++ stream, otherwise, either you will have to return to use the old fopen, fread and fwrite or you will have to re-write the C functions in C++, to make them use C++ streams (this may not be feasible if C functions belong to a third party library). The good news is that there is a third option: use classes in this file, in conjunction with the Boost Iostreams library.

Have a look at the classes and their usage examples ...

Remarks
To properly use these utilities you should be familiar with the Boost Iostreams library: so, please, have a look also to its documentation.

Definition in file cfile_stream.hpp.