How can I use a string within a system(). ex: (input is the string)
system(\"open -a Google Chrome\" \"http://www.dictionary.reference.com/browse/\" + input + \"
system is available in cstdlib
header.
Function takes a c-style string as a parameter. +
doesn't append string literals.
So try -
std::string cmd("open -a Google Chrome");
cmd += " http://www.dictionary.reference.com/browse/" + input + "?s=t";
// In the above case, operator + overloaded in `std::string` is called and
// does the necessary concatenation.
system(cmd.c_str());