Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

I'm getting error: invalid conversion from 'const void*' to 'void*'




I'm getting two errors on my C++ code that I got as an example from the net.The other error is the initializing argument 3 of 'void SendList(int, Addr4882_t*, void*, long int, int)'..I was wondering if anyone could explain to me what it meant and how to rectify the errors.

I have also uploaded pictures to see clearer.. Did I even post the message in the correct forum?? or should this question be posted on a C++ forum? Please, I need serious help..

The code is posted below:



#include <windows.h>
#include "Decl-32.h"
#include <iostream>
#include <string>

using namespace std;

void gpib_error(int errnum, char *errmsg); //error-reporting function

const int BUF_SIZE = 1024; //the size of our input/output buffer
const int NUM_DEVICES = 31; //maximum number of devices on the bus

int main() {

char buffer[BUF_SIZE];
int i, num_listeners; //the number of listeners on the bus
unsigned short address; //the address of a listener

/* Arrays of possible instrument addresses, and actual addresses
The type Addr4882_t is a computer-dependent map to a built-in
data type that holds the number that is the address of a device. */
Addr4882_t instruments[NUM_DEVICES], result[NUM_DEVICES];

//check for an error
if(ibsta & ERR)
gpib_error(1, "Could not send IFC");

for(i = 0; i < NUM_DEVICES - 1; i++)
instruments[i] = i + 1;
instruments[NUM_DEVICES - 1] = NOADDR;

cout << "Finding all listeners on the bus..." << endl;

FindLstn(0, instruments, result, NUM_DEVICES);

if(ibsta & ERR)
gpib_error(2, "Could not find listeners");

num_listeners = ibcnt;
result[num_listeners] = NOADDR;
cout << "Found " << num_listeners << " devices on the bus" << endl;

SendList(0, result, "*IDN?", 5L, NLend);
//check for error
if (ibsta & ERR)
gpib_error(3, "Could not send *IDN? to devices");

for(i = 0; i < num_listeners; i++) {

Receive(0, result[i], buffer, BUF_SIZE, STOPend);
//check for error
if(ibsta & ERR)
gpib_error(4, "Could not receive from device");

address = GetPAD(result[i]);

buffer[ibcnt] = '\0';

//Now output the results
cout << "Device #" << address << " has ID string: " << buffer;

//We're done with the program, so take the board off-line
ibonl (0,0);

void gpib_error(int errnum, char *errmsg) {
cout << "Error #" << errnum << ": " << errmsg << endl;
ibonl(0,0); //take the board offline
exit(1); //terminate program

Download All
0 Kudos
Message 1 of 1