2009-02-21

Executing another executive in your C/C++ program

by Forrest Sheng Bao http://fsbao.net

Well, the trick is very easy, call system.

#include "stdio.h"
#include "assert.h"

int main ()
{
char buffer [50];
sprintf (buffer, "ls");
printf (buffer);
assert(system(buffer) >= 0);
return 0;
}

No comments: