ENH: Added use of process execution.

This commit is contained in:
Brad King 2003-06-10 15:50:45 -04:00
parent 96ccaed54d
commit 6e23bcb50f
1 changed files with 15 additions and 0 deletions

View File

@ -1,7 +1,22 @@
#include <kwsys/Directory.hxx>
#include <kwsys/Process.h>
#include <kwsys/std/iostream>
int main()
{
kwsys::Directory();
kwsysProcess* kp = kwsysProcess_New();
const char* cmd[] = {"echo", "Hello, World!", 0};
kwsysProcess_SetCommand(kp, cmd);
kwsysProcess_Execute(kp);
char* data = 0;
int length = 0;
while(kwsysProcess_WaitForData(kp, kwsysProcess_STDOUT | kwsysProcess_STDERR,
&data, &length, 0))
{
kwsys_std::cout.write(data, length);
}
kwsysProcess_Delete(kp);
kwsys_std::cout << kwsys_std::endl;
return 0;
}