
AMDG Norbert Wenzel wrote:
I've recently been reworking some filereaders and changed them from std::iostream to boost::iostreams::mapped_file_source.
Though the data has been fully loaded the std::getline() did set only the first character of the text and returned false, which caused the usual while loop to exit.
When I wanted to ask you for help and made up a small example, in which the filereading - to my surprise - worked fine. The problem has been, that from rewritting from the code from std::iostreams there was an std::ios::in left. So my actual filereading looked like this:
io::mapped_file_source file("C://test.txt", std::ios::in); io::streamio::mapped_file_source input(file); std::string line; while(std::getline(input, line)) { std::cout << "Line: " << line << std::endl; }
After removing the std::ios::in everything worked as expected. All tests have been made using Boost 1.37 and MSVC8.
It looks like you are calling this constructor: // Constructor taking a list of parameters template<typename Path> explicit mapped_file_source( const Path& path, size_type length = max_length, boost::intmax_t offset = 0 ); In Christ, Steven Watanabe