Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

attach stxxl::vector to file

Rad
2012-12-06
2013-04-25
  • Rad
    Rad
    2012-12-06

    Hi,

    1. as i understood, i can attach an instance of a vector to existing file earlier created using a vector, e.g.

    {
        stxxl::syscall_file not_existed_yet_file("path/to/file/big_file.data", stxxl::file::CREATE | stxxl::file::WRONLY);
        stxxl::vector<int, …> out_vec(&not_existed_yet_file);

        out_vec.push_back(0);
        …
        out_vec.push_back(10000000);
    }//here data is saved to file

    stxxl::syscall_file already_existed_file("path/to/file/big_file.data");
    stxxl::vector<int, …> in_vec(&already_existed_file, stxxl::file::RDONLY);
    //using in_vec

    1. Is it possible to attach vector to a file that already exists, but it created using std::ofstream or stxxl::syscall_file or some other means?

    And for both cases 1 and 2(if second is possible) what template arguments must be provided for blockSize and pageSize to attach a vector to file?
    I have read the documentation for stxxl::vector::vector(file * from), but it is still not clear to me.

    Thanks!