1.

Solve : Calling programs from c++?

Answer»

Im trying to call a program from my c++ program, ive got it to work if i put the program im CALLING in c:/ but if i put it in a folder with a SPACE in its name like 'C:/Program Files' it doesnt see anything after the space, if there is a better way to call programs please let me know. Help will be greatly appreciated.

#include
#include

using namespace std;

int main()
{
cout <<"enter: ";
char a[100];
cin.getline(a , 100);
system(a);

system("pause");
}
use quotes around the filename.Boy, my eyesight is very bad.
I can't find the file name that is not in quotes.Quote from: Geek-9pm on December 18, 2009, 10:12:16 PM

Boy, my eyesight is very bad.
I can't find the file name that is not in quotes.

Quote
system(a);

should be system(STRCAT("\"",strcat(a,"\"")))

or something along those lines. regardless... WHATEVER is in a should be quoted.


Discussion

No Comment Found