• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
2 // (C) Copyright 2005-2007 Jonathan Turkanis
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
5 
6 // See http://www.boost.org/libs/iostreams for documentation.
7 
8 #include <cassert>
9 #include <string>
10 #include <boost/iostreams/stream.hpp>
11 #include <boost/iostreams/detail/ios.hpp> // ios_base::beg.
12 #include <libs/iostreams/example/container_device.hpp>
13 
14 namespace io = boost::iostreams;
15 namespace ex = boost::iostreams::example;
16 
main()17 int main()
18 {
19     using namespace std;
20     typedef ex::container_device<string> string_device;
21 
22     string                     one, two;
23     io::stream<string_device>  io(one);
24     io << "Hello World!";
25     io.flush();
26     io.seekg(0, BOOST_IOS::beg);
27     getline(io, two);
28     assert(one == "Hello World!");
29     assert(two == "Hello World!");
30 }
31