c++stxxl

stxxl save and read vector from disk file


I'm struggling in trying to use the stxxl library in a way, that I cannot only store the data from their vector structure into a file but also recover it from that file in a rerun of my program.

I found out that you can construct a vector from a file ( http://stxxl.sourceforge.net/tags/master/classstxxl_1_1vector.html#a4d9029657cc11315cb77955fae70b877 ) but the class "file" only contains these functions ( http://stxxl.sourceforge.net/tags/master/classstxxl_1_1file.html ) with no way (that I can see) to actually access an existing file with some given path.

Does someone who worked with this library before have an idea how to do that?

Thanks in advance


Solution

  • stxxl::file is an interface base class. Depending on your operating system, you want one of the derived classes

    You can use the stxxl::create_file function to decide at runtime which backend to use. Set the io_impl parameter to "syscall", "wincall", or "linuxaio", respectively.