http://stxxl.sourceforge.net
<dementiev@mpi-sb.mpg.de>
http://www.boost.org/LICENSE_1_0.txt
#include <stxxl/io>
#include <stxxl/vector>
typedef unsigned char my_type;
using stxxl::syscall_file;
using stxxl::file;
int main(int argc, char * argv[])
{
if (argc < 3)
{
std::cout << "Usage: " << argv[0] << " input_file output_file " << std::endl;
return -1;
}
unlink(argv[2]);
syscall_file InputFile(argv[1], file::RDONLY);
syscall_file OutputFile(argv[2], file::RDWR | file::CREAT);
typedef stxxl::vector<my_type> vector_type;
std::cout << "Copying file " << argv[1] << " to " << argv[2] << std::endl;
vector_type InputVector(&InputFile);
vector_type OutputVector(&OutputFile);
std::cout << "File " << argv[1] << " has size " << InputVector.size() << " bytes." << std::endl;
vector_type::const_iterator it = InputVector.begin();
for ( ; it != InputVector.end(); ++it)
{
OutputVector.push_back(*it);
}
return 0;
}