Agar

<-- Back to AG_Intro.3

SYNOPSIS

#include <agar/core.h>

DESCRIPTION

The AG_Execute() function provides a cross-platform interface for executing external applications.

INTERFACE


AG_ProcessID AG_Execute (const char *file, char **argv)

AG_ProcessID AG_WaitOnProcess (AG_ProcessID pid, enum ag_exec_wait_type wait_type)

int AG_Kill (AG_ProcessID pid)


The AG_Execute() function executes the specified file with the given arguments, returning an integer process ID. If an error occured, the function returns -1 and sets an error message accordingly.

AG_WaitOnProcess() checks for status or waits until the specified process terminates. The wait_type argument may be one of:
AG_EXEC_WAIT_IMMEDIATEIf the process has not exited, return immediately without blocking.
AG_EXEC_WAIT_INFINITEBlock the calling thread until the process has exited.

The function returns the PID of the terminated process, -1 if an error occured, or 0 if wait_type is AG_EXEC_WAIT_IMMEDIATE and the process is still running.

The AG_Kill() function immediately terminates the specified process.

SEE ALSO

AG_Intro(3)

HISTORY

The AG_Execute interface first appeared in Agar 1.4.1.

Csoft.net ElectronTubeStore.com