summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/test1.cxx
blob: 7dd61a49438756adb2bcad0370843e42072e4075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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_Pipe_STDOUT |
                                      kwsysProcess_Pipe_STDERR),
                                 &data, &length, 0))
    {
    kwsys_std::cout.write(data, length);
    }
  kwsysProcess_Delete(kp);
  kwsys_std::cout << kwsys_std::endl;
  return 0;
}