1 | /*␊ |
2 | * shell_process.cpp␊ |
3 | *␊ |
4 | * Created by Rekursor on 1/17/2010.␊ |
5 | *␊ |
6 | */␊ |
7 | ␊ |
8 | #include "ShellProcess.h"␊ |
9 | #include <string.h>␊ |
10 | #include <sys/stat.h>␊ |
11 | #include "string_util.h"␊ |
12 | ␊ |
13 | //----------------------------------------------------------------␊ |
14 | // portable open process:␊ |
15 | FILE * ShellProcess::open(const char *cmd, const char *mode) {␊ |
16 | ␉_fpt=::popen(cmd,mode);␊ |
17 | ␉return _fpt;␊ |
18 | }␊ |
19 | ␊ |
20 | //----------------------------------------------------------------␊ |
21 | int ShellProcess::close() {␊ |
22 | ␉int ret = ::pclose(_fpt);␊ |
23 | ␉_fpt=NULL;␊ |
24 | ␉return ret;␊ |
25 | }␊ |
26 | |