Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: Getting the Right Syntax for uploading a file using the exe. of the code below

$
0
0
Hi Steve,

Last question i hope......with the code below, I connect to a server and upload the data I want. However upon running the program for the first time it gives me a "debug error R6010" then when I close it and do nothing but run it again, it works with no issues. Could you help me out with troubleshooting this because my end application is an automation with no option for the user to re run the program if it fails on the first run. Code is:

int _tmain(int argc, _TCHAR* argv[])
{
auto stream = concurrency::streams::file_buffer<uint8_t>::open(U("content being uploaded"), std::ios_base::in).get();

http_client client (U("my server addy"));

http_response response = client.request(methods::POST, U("path"), stream, U("string")).get();
if(response.status_code() == status_codes::OK)
{
cout<<"Connection to Server Sucessful"<<endl;
    const utility::string_t body = response.extract_string().get();
    std::wcout<<body;
}
else
{
    cout<<"Connection to Server UNSUCCESSFUL"<<endl;
}   
//getchar();
return 0;
}

Thanks again.

Steven

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>