Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-07-30 16:57:44


AMDG

Simon Pickles wrote:
> Say I want to copy the contents of a file into memory, how do I do the
> actual copy. Eg
>
> boost::filesystem::path p = "file.txt"
>
> const unsigned int filesize = boost::filesystem::file_size( p );
>
> unsigned char* buffer = new unsigned char[filesize];
>
> // how do I copy file contents into buffer?

You'll want to use boost::filesystem::fstream (in
boost/filesystem/fstream.hpp)

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net