QMExecute()

QMExecute()

Top  Previous  Next

 

The QMExecute() function executes a command on the server.

 

The function arguments are:

 

Cmndis the command to be executed.

 

Erris an integer variable to receive status information. Some variants of the QMClient API do not have this argument.

 

The output from the command is returned as a text string. If the command does not produce any output, the C API returns a null pointer.

 

If the command completes without requesting input, the Err variable is set to SV_OK.

 

If the command requests input, any output up to that point is returned and the Err variable is set to SV_PROMPT. The client may respond to this using the QMRespond() function or abort the command using the QMEndCommand() function.

 

On completion of the command, QMStatus() will return the value of @SYSTEM.RETURN.CODE.

 

The executed command may perform most functions of the QM database. Specific restrictions are:

Input may be requested from the client using the QMBasic INPUT and INPUT@ statements. Use of the KEYIN() function is not allowed.

Testing for input using the QMBasic KEYREADY() function or the INPUT -1 syntax will not show input waiting.

The length parameter and special options such as HIDDEN and UPCASE in an INPUT statement will be ignored if present. Only simple input is supported via QMExecute().

Execution of a further command from within the executed command may not behave correctly.

 

The example program fragments below run a program named MYPROG on the server. This program repeatedly outputs data using CRT, DISPLAY or PRINT and prompts for user input. Each output /response pair is handled by the client loop until the program terminates.

 

hmtoggle_plus1C

 

hmtoggle_plus1VB.Net

 

hmtoggle_plus1QMBasic Class Module

 

hmtoggle_plus1Java

 

hmtoggle_plus1Python

 

 

See also:

QMEndCommand, QMRespond()