Exec

From Bennu Wiki
(Redirected from \ P WAIT)
Jump to navigation Jump to search


Definition

INT exec ( <INT mode> , <STRING executable>, <INT number_of_arguments> , <STRING POINTER arguments> )

Executes the specified executable with the specified arguments in the specified mode.

Parameters

INT mode - The mode to call the executable (_P_WAIT/_P_NOWAIT).
STRING executable - The executable to start.
INT number_of_arguments - The number of arguments given with arguments
STRING POINTER arguments - Pointer to an array of strings to be passed; number_of_arguments strings will be passed as arguments.

Returns

INT

-1 - Error.
mode==_P_WAIT: - The exit status of the executable.
mode==_P_NOWAIT: - The process ID of the executable. This is not a ProcessID, it is a process ID of the operating system.

Notes

The mode parameter can be two things:

_P_WAIT - Wait for the executable to exit.
_P_NOWAIT - Do not wait for the executable to exit.

Example

Open file.txt in notepad:

import "mod_sys"

Process Main()
Private
    string arg;
Begin
    arg = "file.txt";
    exec(_P_NOWAIT,"notepad.exe",1,&arg);
End

Used in example: exec(), pointer


Mod_sys
Constants
Functions Exec()Getenv()