Boost C++ Libraries: Ticket #5694: Cannot use managed_mapped_file to handle a txt file https://svn.boost.org/trac10/ticket/5694 <p> On Windows or Linux, we can map a txt file into the current process' address space, and then use those string handling functions with the return value (the pointer to the first byte of the content of the txt file) to deal with the file. So I wrote such an expression: boost::interprocess::managed_mapped_file mmf( </p> <blockquote> <p> boost::interprocess::open_only, txt_file_name </p> </blockquote> <p> ); But it throwed an exception when the line 424 in the file managed_open_or_create_impl.hpp was executed: </p> <blockquote> <p> if(value != <a class="missing wiki">InitializedSegment</a>) </p> <blockquote> <p> throw interprocess_exception(error_info(corrupted_error)); </p> </blockquote> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5694 Trac 1.4.3 Ion Gaztañaga Sat, 24 Dec 2011 11:04:48 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5694#comment:1 https://svn.boost.org/trac10/ticket/5694#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> <p> You are using the wrong class. Managed_mapped_file is for files created with this class. To simply map a txt use file_mapping + mapped_region. </p> Ticket