R
Ramon F Herrera
I have looked all over the net for this, but all the hits I get are
about cout, cin or streams linked to disk files.
The feature that I need is in-core (boy, that's an ancient term)
streams and buffers.
Back when I was a C programmer, I implemented my own streaming like
this:
char output_buffer[150 *1024];
char pointer = *output_buffer;
pointer += sprintf(pointer, "Some text here %s\n", somevariable1);
pointer += sprintf(pointer, "Some more text here %s\n",
somevariable2);
pointer += sprintf(pointer, "Some further stuff here %s\n",
somevariable3);
I then discovered something that looks exactly what I need, but it is
inside the Boost library. See snippet below.
I bet that standard C++ and/or the STL must contain some facility that
performs the functionality of the code below.
TIA,
-Ramon
--------------------------
boost::asio::streambuf request;
std:stream request_stream(&request);
request_stream << "GET " << argv[2] << " HTTP/1.0\r\n";
request_stream << "Host: " << argv[1] << "\r\n";
request_stream << "Accept: */*\r\n";
request_stream << "Connection: close\r\n\r\n";
// Send the request.
boost::asio::write(socket, request);
about cout, cin or streams linked to disk files.
The feature that I need is in-core (boy, that's an ancient term)
streams and buffers.
Back when I was a C programmer, I implemented my own streaming like
this:
char output_buffer[150 *1024];
char pointer = *output_buffer;
pointer += sprintf(pointer, "Some text here %s\n", somevariable1);
pointer += sprintf(pointer, "Some more text here %s\n",
somevariable2);
pointer += sprintf(pointer, "Some further stuff here %s\n",
somevariable3);
I then discovered something that looks exactly what I need, but it is
inside the Boost library. See snippet below.
I bet that standard C++ and/or the STL must contain some facility that
performs the functionality of the code below.
TIA,
-Ramon
--------------------------
boost::asio::streambuf request;
std:stream request_stream(&request);
request_stream << "GET " << argv[2] << " HTTP/1.0\r\n";
request_stream << "Host: " << argv[1] << "\r\n";
request_stream << "Accept: */*\r\n";
request_stream << "Connection: close\r\n\r\n";
// Send the request.
boost::asio::write(socket, request);