Run file from given location

Hi! I am trying to run a file from a given location,in this case CCleaner,from path C:/Program Files/CCleaner/CCleaner64.exe...But the program won't even let me compile (I'm using CodeBlocks),because it gives error:

Build: Debug in Optimizer (compiler: GNU GCC Compiler)
E:\Programs\Optimizer\main.cpp||In function 'int main()':|
E:\Programs\Optimizer\main.cpp|13|error: expected ')' before 'given'|
Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s))

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <stdlib.h>
#include <string>

using namespace std;

int main ()
{
    string given;
    cout << "Give the location of CCleaner"<<endl;
    cin >> given;

    system ("START"given);

return 0;
}



Can somebody help? How would this work? Thanks in advance.

GamingDj
"START"given this is not a string.
1
2
3
4
5
6
7
8
9
10
11
12
main()
{
    string given;
    string command = "START "; //there is a space after START

    cout<<"Enter location"<<endl;
    cin>>given;

   command += given;

   system(command.c_str());
}
Thank you!
Topic archived. No new replies allowed.