stream oriented io
This commit is contained in:
parent
6370ef31e8
commit
faf9cf0c3e
|
@ -68,3 +68,8 @@ add_executable(input_buffer
|
|||
src/chapter02_io/input_buffer.cpp
|
||||
src/sdk.h)
|
||||
target_link_libraries(input_buffer PRIVATE Threads::Threads)
|
||||
|
||||
add_executable(stream_oriented_buffers
|
||||
src/chapter02_io/stream_oriented_buffers.cpp
|
||||
src/sdk.h)
|
||||
target_link_libraries(stream_oriented_buffers PRIVATE Threads::Threads)
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#include "../sdk.h"
|
||||
#include <boost/asio.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using namespace boost;
|
||||
namespace sys = boost::system;
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
asio::streambuf buf;
|
||||
ostream output(&buf);
|
||||
|
||||
output << "Message1\nMessage2"s;
|
||||
istream input(&buf);
|
||||
|
||||
string message1;
|
||||
|
||||
std::getline(input, message1);
|
||||
|
||||
assert(message1 == "Message1"s);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue