1

I'm trying to write a code in C++ that allows you to enter some text and it will open a website with the variable s_input appended to it. However, I get this error:

'system' : cannot convert parameter 1 from 'std::string' to 'const char *'

I get that error for the last line you see.

cin >> s_input; transform(s_input.begin(), s_input.end(), s_input.begin(), tolower); s_input = "start http://website.com/" + s_input + "/0/7/0"; system(s_input); 

I am new to C++ and this is more of a learning program.. So please show as many examples as possible! Thanks!

1
  • You really mean system API? Use ShellExecute, ShellExecuteEx or CreateProcess Commented Jul 18, 2012 at 7:58

1 Answer 1

7

If s_input is a std::string (I'm betting it is):

system(s_input.c_str()); 

The function system takes a const char* as parameter, as the error message clearly states.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.