Puting strings together

So i have a program that asks for a http link and puts that into a string. I get errors when i do this.

string link = "somerandomlink";
string x = "wget "link" -P Pak";
system(x);

How can i put those strings together and how will i be able to use system with it?
Hello

1
2
3
4
5
6
7
8

std::string link = "https://www.google.com";
std::string cmd = "wget \"" + link + "\" -P Pak";

std::cout << cmd << std::endl; 

// -> wget "https://www.google.com" -P Pak


BTW, you should use `popen`, or if you are in a posix env, `posix_spawn`
Last edited on
Topic archived. No new replies allowed.