You want the code for it? or what??
Code:
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
int ret=0;
if(argv != 3)
{
printf("Usage %s [directory] [program]\n", argv[0]);
return -1;
}
if(!chdir(argv[1]))
if(!(ret=system(argv[2])))
return 0;
else
{
printf("Failure executing %s\n", argv[2]);
return ret;
}
else
{
printf("Failure changing to %s\n", argv[1]);
return -1;
}
}
Or do yu want a more complex code, where you dup(), fork(), write(), read() and waitpid() for the program execution. So you capture everything your external execution does.
Can't .NET compile to something like a [selbstendiger/Selvstændig] app, sorry can't remember the english name..
Else get
Cygwin