hello, im trying to get the following code work:

#include <iostream.h>
#include <string>
using namespace std;
     int main()
     {
     string c;
     string a ("start ");
     string b ("http://images.google.com/images?q=");
     cin >> c;
     string d (a+b+c);
     system(d);
     }

It gives me the error

cannot convert `std::string' to `const char*' for argument `1' to `int system(const char*)'

Does anyone know what im doing wrong? :<
Please help!

Recommended Answers

All 2 Replies

system(d.c_str()); system() takes a const char*, not std::string

Essh the amount of times this question has popped up.. :icon_exclaim:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.