A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/exec_8cpp_source.html below:

NCBI C++ ToolKit: src/gui/utils/exec.cpp Source File

43  const

vector<string>& args,

44  const string

& std_in,

58

max_time = timeout->

sec

+ timeout->

usec

/ 1000000.0;

69  size_t

total_bytes_written = 0;

70  bool

out_done =

false

;

71  bool

err_done =

false

;

73  const size_t

buf_size = 4096;

76  while

(!out_done || !err_done) {

79  if

(total_bytes_written < std_in.size()) {

80

pipe.

Write

(std_in.c_str() + total_bytes_written,

81

std_in.size() - total_bytes_written,

83

total_bytes_written += bytes_written;

84  if

(total_bytes_written == std_in.size()) {

94

rstatus = pipe.

Read

(

buf

, buf_size, &bytes_read);

95

std_out.append(

buf

, bytes_read);

104

std_err.append(

buf

, bytes_read);

120

pipe.

Close

(&exit_value);

static int Exec(const string &cmd, const vector< string > &args, const string &std_in, string &std_out, string &std_err, STimeout *timeout=0)

Run an executable using strings for std* .

EIO_Status Write(const void *data, size_t count, size_t *written=0)

Write data to pipe (data always goes to the child's eStdIn handle).

EIO_Status Open(const string &cmd, const vector< string > &args, TCreateFlags create_flags=0, const string &current_dir=kEmptyStr, const char *const envp[]=0, size_t pipe_size=0)

Open pipe.

EIO_Status SetTimeout(EIO_Event event, const STimeout *timeout)

Specify timeout for the pipe I/O.

EIO_Status Read(void *buf, size_t count, size_t *read=0, EChildIOHandle from_handle=eDefault)

Read data from the pipe's default read handle.

EIO_Status CloseHandle(EChildIOHandle handle)

Close the specified child's pipe handle (even for CPipe opened with OpenSelf()).

EIO_Status Close(int *exitcode=0)

Close pipe.

@ fStdErr_Open

Do open child's stderr.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

double Elapsed(void) const

Return time elapsed since first Start() or last Restart() call (in seconds).

void Start(void)

Start the timer.

unsigned int usec

microseconds (modulo 1,000,000)

@ eIO_Timeout

timeout expired before any I/O succeeded

@ eIO_Success

everything is fine, no error occurred

@ eIO_Open

also serves as no-event indicator in SOCK_Poll

@ eIO_Close

also serves as an error indicator in SOCK_Poll

Portable class to work with a spawned process via pipes.

Defines: CTimeFormat - storage class for time format.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4