QMGetArg()

Top  Previous  Next

 

The QMGetArg() function retrieves the value of argument variables updated by a catalogued subroutine on the server called using QMCallx.

 

 

Format

 

Cchar * QMGetArg(short int ArgNo)

 

where

 

ArgNois the argument number (from 1) to be retrieved.

 

 

The QMGetArg() function, available only in the C API, retrieves the value of an argument updated by a subroutine called using QMCallx. Use of QMCallx and QMGetArg() removes the need for the calling program to know the maximum size of the returned data as is required with QMCall.

 

The return value from this function is a pointer to a dynamically allocated memory area that receives the value of the specified argument. If the argument number is invalid or the called subroutine returned a null string, the pointer will be NULL. The memory allocated by QMGetArg() must subsequenlty be released using QMFree().

 

An argument may be retrieved multiple times, each use of QMGetArg() allocating a new memory area. Use of QMGetArg() to retrieve an argument that was not modified by the subroutine will return the corresponding argument value as passed into QMCallx. Argument data remains accessible until the next use of QMCallx.

 

In applications that open multiple simultaneous server connections, the argument data is maintained on a per-session basis, reflecting the most recent use of QMCallx in the currently selected session.

 

 

Example

 

C

char * ErrMsg

QMCallx("SET.CREDIT.LIMIT", 3, Client, NewLimit, "");

ErrMsg = QMGetArg(3);

If (ErrMsg != NULL) printf("Failed - %s\n", ErrMsg);

 

The above example calls a subroutine on the server that sets the credit limit for a specific client. The subroutine takes three arguments, the third of which is used to return an error message if the action fails. Note how the third argument is passed into QMCallx() as a null string so that any old content of this variable is not unnecessarily sent across the network to the server. To optimise network traffic, the server only returns arguments values if they have been modified by the called subroutine.

 

 

See also:

QMCallx