basic file io in boost 1_34_1. A compilable 'hello world' example for large (>2^31byte) files?

Dear Boost Users, I've used boost on and off for years for its string parsing. Now I'd like to use it to replace std::ifstream for file reading. The immediate requirement is a file > 2^31 bytes. Since my requirement is to replace ifstream, I was hoping for a fairly simple transition, perhaps even something I could manage with an emacs global search-and-replace. I started with kubuntu-feisty's boost 1.33.1. but was unable to execute the first main in the iostreams tutorial Overview (2.1.1). The showstopper was the compiler error <file_sink> not defined in scope. % g++ test.cpp test.cpp: In functin 'int main()': test.cpp::9: error: 'file_sink' was not declared in this scope . . . several more errors. This is an error without precedent, at least according to google. Thinking this is a kubuntu-apt-get issue, I downloaded and rebuilt and installed boost 1_34_1 from scratch. Alas, <file_sink> is still not declared. Am I doing something obvious wrong? I'm using g++ 4.1.2. Does anyone have a few lines of code that will * open a file? * seekg() to the beginning, end and arbitrary location in the file? * tellg() the present file pointer location in the file? * read(address, number of bytes) from the file? These are the basic STL features I'm trying to replace. Many thanks for any pointers to useful documentation (but not to boost.org/libs/iostreams/doc/index.html, please) or code snippets. Once I have my "hello world" working, I might start making sense of <file_sink> templated streams, and why my install can't find <file_sink> when it is sitting right there in <boost/iostreams/device/file.hpp>!?!? -- Peter Leopold Peter dot Leopold at BioAnalyte dot com <http://www.bioanalyte.com>

Peter Leopold wrote:
Dear Boost Users,
I started with kubuntu-feisty's boost 1.33.1. but was unable to execute the first main in the iostreams tutorial Overview (2.1.1). The showstopper was the compiler error <file_sink> not defined in scope.
% g++ test.cpp test.cpp: In functin 'int main()': test.cpp::9: error: 'file_sink' was not declared in this scope . . . several more errors.
try changing the offending line to: io::stream_buffer<io::file_sink> buf("log.txt"); In other words, its a documentation bug... the file_sink is in the boost::iostreams namespace as well.
participants (2)
-
eg
-
Peter Leopold