Chciałem zrobić program tak by wchodził na stronę(to google.pl podałem tylko dla przykładu) z dowolnie podanym ID
np. http://google.pl/id/1234/download
Ale coś program nie chce działać i wyskakuje poniższy błąd. Szukałem w internecie informacji na ten temat, ale niestety nic nie znalazłem.
Ale domyślam się, że błąd jest związany z "system(adresik);". Prosiłbym o pomoc i wyjaśnienie co zrobiłem nie tak.
C:\C++\test\main.cpp|22|error: cannot convert 'std::string {aka std::basic_string<char>}' to 'const char*' for argument '1' to 'int system(const char*)'|
#include <iostream>
#include <cstdlib>
#include <sstream>
using namespace std;
int x;
string poczatek, xdd, koncowka, calosc, adresik;
int main()
{
cin>>x; //wpisywanie id
ostringstream ss; //przemiana int na string
ss << x;
string str = ss.str();
xdd=str;
poczatek="http://google.pl/id/";
koncowka="/download";
calosc=poczatek+xdd+koncowka; // cały adres
adresik="start "+calosc;
system(adresik);
return 0;
}
vpiotr