command for run a file

pls I need to run file in C++,but I dont know a command
pls help
hi, what do u mean by run file?
u mean by that is run application in c++ program?
this code helps you:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <windows.h>
#include <atlstr.h>
#include <stdio.h>


int main()
{

	CString str= "c:/Windows/System32/calc.exe";
	CString action= "open";
	ShellExecute(NULL,action,str,NULL,NULL,SW_SHOW);                                  
	getchar();
	return 0;

};


maybe this helps you;)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* system example : DIR */
#include <stdio.h>
#include <stdlib.h>

int main ()
{
	int i;
	printf ("Checking if processor is available...");
	if (system(NULL)) puts ("Ok");
	else exit (1);
	printf ("Executing Calc...\n");
	i = system ("c:/windows/system32/calc.exe");                                               
	printf ("The value returned was: %d.\n",i);

	getchar();
	return 0;
}
Last edited on
Topic archived. No new replies allowed.