gclib  1.36.3
Communications API for Galil controllers and PLCs

◆ GCommand()

GCLIB_DLL_EXPORTED GReturn GCALL GCommand ( GCon  g,
GCStringIn  command,
GBufOut  buffer,
GSize  buffer_len,
GSize bytes_returned 
)

Performs a command-and-response transaction on the connection.

Parameters
gConnection's handle.
commandNull-terminated command string to send to the controller. The library will append a carriage return to the command string.
bufferBuffer for the response. Will be filled with the response from the controller. The data will be null terminated unless the function returns G_BAD_LOST_DATA due to the buffer being too small to hold the data.
buffer_lenThe size of the response buffer.
bytes_returnedThe size of the data returned from the controller. This does not include null termination. This argument may be null if the value is not desired.
Returns
The success status or error code of the function. See gclib_errors.h for possible values.

See x_gcommand.cpp for an example.

Referenced by commands(), error(), GCmd(), GCmdD(), GCmdI(), GCmdT(), GWaitForBool(), and motion_complete().