Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/iostreams/example/container_device_example.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 892 bytes
Line 
1// (C) Copyright Jonathan Turkanis 2005.
2// Distributed under the Boost Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
4
5// See http://www.boost.org/libs/iostreams for documentation.
6
7#include <cassert>
8#include <string>
9#include <boost/iostreams/stream_facade.hpp>
10#include <boost/iostreams/detail/ios.hpp> // ios_base::beg.
11#include <libs/iostreams/example/container_device.hpp>
12
13namespace io = boost::iostreams;
14namespace ex = boost::iostreams::example;
15
16int main()
17{
18    using namespace std;
19    typedef ex::container_device<string> string_device;
20
21    string                            one, two;
22    io::stream_facade<string_device>  io(one);
23    io << "Hello World!";
24    io.flush();
25    io.seekg(0, BOOST_IOS::beg);
26    getline(io, two);
27    assert(one == "Hello World!");
28    assert(two == "Hello World!");
29}
Note: See TracBrowser for help on using the repository browser.