It is a little confusing what you have going on here. You are opening a file for output, then reading the response body into that file. Then it looks like you are trying to read the file for input through a raw pointer. First off you didn't open the file for
input, second you can't get a raw pointer to a file stream.

I think what you are trying to do is get a raw pointer to the memory containing the response stream. Here is one way the code could look:

http_client client(U("address"));
http_request request(methods::GET);
// set a stream backed by a vector that the entire response body should be written to
container_buffer<std::vector<uint8_t>> responseBody; // container_buffer is in cpprest/containerstream.h
request.set_response_stream(responseBody.create_ostream());
client.request(request).then([](http_response response)
{
// headers have arrived...
// inspect the status code...
// return a task that will be completed once entire response body has arrived
return response.content_ready();
}).then([responseBody](::pplx::task<http_response> bodyArrivedTask)
{
try
{
bodyArrivedTask.wait();
// response body has completely arrived, extract the backing vectory containing the data
std::vector<uint8_t> body = std::move(responseBody.collection());
// TODO you now have the response body in a std::vector and do whatever...
}
catch (const http_exception &e)
{
// handle any exceptions
}
});

In this snippet I'm have the response body be directly written into a std::vector. Once completed you have access to the raw memory and can do whatever. This is probably the most efficient because it avoids any additional copies. Here is another similar way,
but waits until the response body has arrived and then copies into a vector.

The read_to_end operation is asynchronous you aren't actually waiting for it to complete. You need to do response1.body().read_to_end(container).wait(); Please note in general I would recommend avoiding waiting on potentially blocking I/O.

In your call to memmove you are not accessing the actual memory in the vector. Instead you are treating the vector as if it is a raw pointer to the data. What you shold be doing is getting a pointer to the first element in the vector, since the data is
stored contiguously. You should be doing something like this: