Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

IBRD reads expected response unde ICBC but does not in QBASIC

when I use ibwrt with my device, it works OK in all cases (I assume). When I read with ibrd, it reads OK when only one number is in the response, but when there are three numbers, it does not read a bit. I set receiving string variable to " ", so it is not zero length, but it still remains the same after ibrd. when I use interactive control, the response reads OK, three numbers with commas, what is scoop?
0 Kudos
Message 1 of 2
(3,143 Views)
Hi,

I'm not to familiar with QBASIC, but I'll explain the what happens with the strings in C. Maybe in QBASIC they are handled the same.

In C, string a NULL terminated arrays of characters. The string you use, " ", would not be interpreted as an empty string, but as a 4 character string (filled with spaces). To write and empty string you would wirte '\0' or just 0 (no qoutes).

In the examples provided (for C) the buffer that stores the result of ibrd is terminated using the ibcnt variable:

buffer[ibcnt] = '\0'

This is needed because the ibrd functions does not terminate the string.

Hope this helps.

DiegoF.


In the examples we provide
Message 2 of 2
(3,143 Views)