Hello,
In the examples the url option always seems to be hard coded into the 
programs. I am seeking to set the url option depending upon selections made 
by the user at the command line. This is probably easily done, but I am new 
to using libcurl and curlpp and cannot figure out how to do it. So for 
example:

#include <iostream>
#include <string>
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>

int main()
{
  // code selection of a url
  cURLpp::Cleanup mycleanup;
  int option;
  curlpp::options::Url myurl;
  std::cout << "Input option '1' for uk or option '2' for us \n";
  std::cin >> option;
  switch(option)
    {
    case 1:
      std::cout << "Option 1 selected...\n";
      myurl = "http://www.uk.co.uk";;
      break;
    case 2:
      std::cout << "Option 2 selected...\n";
      myurl = "http://www.us.com";;
      break;
    }
  
  
  return 0;
}

This code does not compile but i am trying to achieve something similar to 
this with my code. 

As an alternative to help explain my problem, consider this:

curlpp::options::Url myurl(std::string("https://www.google.com";));

Now if that was the url i wanted to use all the time - that would be fine. 
But depending upon selection of an option in my code, i might want to set 
the target url to "http:www.lycos.com" or perhaps "http://www.yahoo.com";. 
In other words, the target url only becomes known at runtime and is 
dependant upon a user selection at the command line.

>From what I can understand, the documentation appears to say that url takes 
the following argument (const char *link) - so can what i seek be achieved 
with a pointer or reference to a string? I would appreciate a snippet of 
code if you are able to help with this.
 
thanks

-- 
You received this message because you are subscribed to the Google Groups 
"curlpp" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/curlpp?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to