| gclib 1.35.5 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

  g | Connection's handle.
  command | Null-terminated command string to send to the controller. The library will append a carriage return to the command string.
  buffer | Buffer 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_len | The size of the response buffer.
  bytes_returned | The 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().