Function pipe_cmd_string (o2scl)

O2scl : Function List

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 to nmax characters in result.

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 to nmax characters.

This function always throws exceptions if it fails.

Note

The result string may contain a carriage return at the end.