Functions pipe_cmd_string¶
-
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
cmd
up tonmax
characters 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_fail
is 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
cmd
up tonmax
characters.This function always throws exceptions if it fails.
- Note
The result string may contain a carriage return at the end.