|
static int | run_shell (const std::string &cmdstr, std::string &respstr) |
|
Definition at line 20 of file CommandLine.h.
◆ CommandLine()
◆ ~CommandLine()
◆ run_shell()
int run_shell |
( |
const std::string & |
cmdstr, |
|
|
std::string & |
respstr |
|
) |
| |
|
static |
Definition at line 14 of file CommandLine.cc.
15{
16 FILE* fp = ::popen(cmdline.c_str(), "r");
17 if (fp == NULL) {
18 fprintf(stderr, "run_shell: Error to run command : %s\n", cmdline.c_str());
19 return -1;
20 }
21 char buf[4096];
22 fgets(buf, 4096, fp);
23 buf[strlen(buf) - 1] = '\0';
24 response = std::string(buf);
25 fclose(fp);
26 return 0;
27}
The documentation for this class was generated from the following files: