Hi all,

I'm trying to use boost::iostream::mapped_file_source directly, but I can't close and then re-open the file without getting an exception. Here is an example.

**********************************************************************************************

#include <boost/iostreams/device/mapped_file.hpp>

int main( void )
{
    std::string fileName( "SomeFile.ext" );
    int osAlignment = boost::iostreams::mapped_file_source::alignment();

   boost::iostreams::mapped_file_source fileMap( fileName, 2 * osAlignment, 0 );

   // Load data to application memory using fileMap.data();

   fileMap.close();

   // The following line throws because fileMap.is_open() returns true
   fileMap.open( fileName, 1024 * osAlignment, 1024 * osAlignment );

   // Load more data to application memory using fileMap.data();

   return 0;
}

*****************************************************************************************
What I truly don't understand is why a call to is_open() woud return true immediately after a call to close(). What do I need to do to be able to map
different parts of the same file? I can't map the whole file because the number
of files that I need to process is large enough that I'd run out of allocation
space for my process.


Thanks guys.

Victor

I'm using boost 1.33.1 with Visual Studio 2003 on WinXP SP2.


Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.