Hi,
I am trying to use "spawn" function and/or "system()". I was successfull in running "system()" but I always had to put the child program at a specific location (I do not know how to change path to point to the location of child program). So I then switched to using "spawn()".
I am usig pretty simple arguments and settings and yet I get the error "Invalid Argument " (when I use perror). Please have a look at code below and if someone can tell me why?. I have tried several permuations and referred documentation in VC++ help as well but I can't seem to figure out right now
Note: child program = "test_system.exe"
Code:
Code:
char mode[]="_P_WAIT";
char path[]="C:\test_system.exe";
char path1[]="sdfor.exe";
char args[]="NULL";
//char path[]="test_system\test_system.exe";
printf("STart exe file\n");
i=spawnlp(mode,path,"test_system.exe",NULL);
perror("The message for error\n");
printf("%d",i);
printf("End of exe file\n");
I hope I have used code tags the right way if not please let me know and I will repost
Thanks
Nipun