diff options
Diffstat (limited to 'libvxi11client/libvxi11client.c')
-rw-r--r-- | libvxi11client/libvxi11client.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c index 4b17532..a6a5dd2 100644 --- a/libvxi11client/libvxi11client.c +++ b/libvxi11client/libvxi11client.c @@ -171,16 +171,17 @@ int vxi11_readstatusbyte(VXI11Context* context, bool waitforlock) { } /** - * write to the connected device + * write to the connected device. If len is less than 0 the length will be calculated with strlen + * **only safe for standard terminated strings** */ -int vxi11_write(VXI11Context* context, char* data, unsigned int len, bool waitlock, bool end) { +int vxi11_write(VXI11Context* context, char* data, int len, bool waitlock, bool end) { if (context->clnt == NULL) return 0; Device_WriteParms params = { .lid = context->devicelink, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .flags = vxi11_generateflags(waitlock, end, false) }; - params.data.data_len = len; + params.data.data_len = len < 0 ? (strlen(data) + 1) : len; params.data.data_val = data; Device_WriteResp* resp = device_write_1(¶ms, context->clnt); |