Inserting a String(variable) into an address

Can you change an address by including a string(variable) within the address?

For example, I'm writing a program that will access a webpage based on user input. Like so:

1
2
3
4
5
string word ("dog");
    curl_global_init(CURL_GLOBAL_ALL);

	std::ofstream ofs("c:/output.txt");
	if(CURLE_OK == curl_read("http://www.encyclopedia.com/topic/dog.aspx", ofs)) {}


I would like to ask the user to input the subject and change the address based on the user input...in the above address, the word dog.aspx would be substituted with word".

I know this isn't a fullproof way of searching for information online...I'm interested in the knowledge of how this would be done...any ideas?
Last edited on
http://cplusplus.com/reference/iostream/stringstream/

though in this case, you could just do this:
string("http://www.encyclopedia.com/topic/")+word+".aspx"
Last edited on
thanks
Topic archived. No new replies allowed.