Function pipe_cmd_string (o2scl)¶
-
int o2scl::pipe_cmd_string(std::string cmd, std::string &result, bool err_on_fail = true, int nmax = 80)¶
Store the first line from the output of the shell command
cmdup tonmaxcharacters inresult.Note
This function uses popen() and may not work properly on some systems. If HAVE_POPEN was not defined during O2scl’s compilation, then this function will throw an exception (or if
err_on_failis false, it will return a nonzero value).Note
The result string may contain a carriage return at the end.
-
std::string o2scl::pipe_cmd_string(std::string cmd, int nmax = 80)¶
Return the first line from the output of the shell command
cmdup tonmaxcharacters.This function always throws exceptions if it fails.
Note
The result string may contain a carriage return at the end.