Functions4U Reference. LocalProcessX
|
|
class LocalProcessX
LocalProcessX permits to launch child executables and batch files managing its input and output.
It is based in LocalProcess2 including some elements to ease its use like WhenTimer callback that lets user to manage program status.
bool Start(const char *cmd, const char *envptr = 0, const char *dir = 0, double refreshTime = -1, double maxTimeWithoutOutput = -1, double maxRunTime = -1, bool convertcharset = true)
Starts child process defined by command line cmd, with envptr environment variables, in folder dir.
If refreshTime is defined, the Perform function will be called periodically.
maxTimeWithoutOutput is the maximum time permitted without child program text output (by functions like printf) and maxRunTime is the maximum child program run time. convertcharset .defines if character set has to be converted.
void Perform()
Perform manages child program and calls WhenTimer user function.
void Stop(ProcessStatus status = STOP_USER)
Stops child program, subprograms and threads, with status.
void Pause()
Pauses child program, subprograms and threads.
bool IsPaused()
Returns true if child program is paused.
double Seconds()
Returns number of child program running elapsed seconds.
void Write(String str)
Sends str string to child program.
int GetStatus()
Returns child program status.
It is defined in ProcessStatus and it can be:
RUNNING
STOP_OK
STOP_TIMEOUT
STOP_USER
bool IsRunning()
Returns true if child program is running.
Gate4<double, String&, bool, bool&> WhenTimer
Permits to include user function to handle:
Inputs
Running time elapsed
String output by child program
Child program status
Output
To reset time without program output timeout
|