I am reading trace data from an HP8720D network analyzer. I am writing code C++ code (compiling with Borland Turbo C++ 3.00). I am using the functions "Receive" and "Send" to send and receive data on the GPIB. After using the Receive function to receive ASCII data, the value of the global variable "ibcntl" has value 10050 which I understand to mean that 10050 bytes were received. I would expect that an array of 10050 bytes would be enough for the receive buffer. However I have found that when the receive buffer (an array of type char) is 11000 elements, the array will contain only part of the data and garbage after. If I increase the size of the array to 14000, I get all of the data and no garbage. Have I misu
sed the functions? Is there some explanation for this? Here are the pertinent lines of my code:
const int trace_array_num_bytes = 14000;
char rcv_trace_data8720D[trace_array_num_bytes];
//retrieve data from analyzer.
Send(GBLGPIBboard,GPIB_ADDR_8720D,"FORM4",5,NLend);
Send(GBLGPIBboard,GPIB_ADDR_8720D,"OUTPFORM",8,NLend);
Receive(GBLGPIBboard,GPIB_ADDR_8720D,rcv_trace_data8720D,
trace_array_num_bytes,STOPend);
GBL_sn_data_out.put('\n');
GBL_sn_data_out.write(rcv_trace_data8720D,ibcntl);
GBLmainwin <<<"Number of bytes received in trace dump:"<