Aug 13, 2012 at 10:16pm UTC
I need help.
I am trying to make the console star a website. I want to make It so you type in a website and then It starts it up.
1 2 3 4 5 6
if (URL == 3){
string Search;
cout << "Enter URL: " ;
cin >> Search;
cout << "\nStarting: " << Search;
system("start Search" );}
I can't get system to recognize Search as a data type and not a word.
I bet the answer is real simple but I can't figure it out.
Last edited on Aug 14, 2012 at 1:24pm UTC
Aug 13, 2012 at 10:26pm UTC
You're not making a lot of sense. On your operating system, in a command window, what does typing in this do?
That's what you seem to be trying to automate.
Last edited on Aug 13, 2012 at 10:31pm UTC
Aug 13, 2012 at 11:04pm UTC
I want to be able to have someone enter a website and have the console start the website.
Aug 13, 2012 at 11:12pm UTC
So...instead of someone running the browser and typing in the URL, you're making a C++ program that the user has to run, type in the URL and then have your program load the browser?
Anyways, to fix your problem: system("start /* Web Browser.exe */ " + URL);
Now it's up to you to figure out the exact syntax on how to open your browser.
Aug 13, 2012 at 11:31pm UTC
When I do that is says
error C2664: 'system' : cannot convert parameter 1 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'const char *'
but when I did it, I changed
to Search
Last edited on Aug 13, 2012 at 11:33pm UTC
Aug 13, 2012 at 11:33pm UTC
ugh...
system("start browser.exe " + URL.c_str());
Aug 14, 2012 at 12:01am UTC
No I want to do it from c++
Aug 14, 2012 at 12:37am UTC
Ill try it soon. I'm working on something else right now.
Aug 14, 2012 at 12:38am UTC
Thank you Moschops, I couldn't think about why it wasn't working.
Aug 14, 2012 at 2:16am UTC
Moschops, it gives no errors but it won't start a website.