cannot CreateProcess()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//all the includes
void startProgram(const string);
int main(int, char *[]) {
	startProgram("test.exe");
	return 0;
}

void startProgram(const string application){
	STARTUPINFO         siStartupInfo;
    PROCESS_INFORMATION piProcessInfo;
	if(CreateProcess(application.c_str(), NULL, 0, 0, FALSE, 
			CREATE_DEFAULT_ERROR_MODE, 0,0, 
			&siStartupInfo, &piProcessInfo)){
		cout << "true" << endl;
	}
	else{
		cout << "false" << endl;
	}
}


returns

false



what am i doing wrong?

test.exe is a hello world program.
Last edited on
Is it in the same directory as where you are running this program?
Topic archived. No new replies allowed.