Are you looking for
system()
or perhaps
_popen()
? [NB there's wide char versions of those also as
wsystem() and _wpopen()
e.g
#include <cstdlib>
int main()
{
system("dir");
return 0;
}
just runs a "dir" command without having to open a console.
_popen()
does the same thing, but opens a pipe so that you can read or write to the command e.g.
#include <cstdlib>
#include <iostream>
int main()
{
FILE *cmdPipe = _popen("dir", "r");
char buff[1024];
while(fgets(buff, sizeof buff, cmdPipe) != NULL)
std::cout << buff;
fclose(cmdPipe);
return 0;
}