<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic I'm getting error: invalid conversion from 'const void*' to 'void*' in Instrument Control (GPIB, Serial, VISA, IVI)</title>
    <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/I-m-getting-error-invalid-conversion-from-const-void-to-void/m-p/1950367#M52844</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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..&lt;/P&gt;
&lt;P&gt;The code is posted below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;#include &amp;lt;windows.h&amp;gt;&lt;BR /&gt;#include "Decl-32.h"&lt;BR /&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include &amp;lt;string&amp;gt;&lt;/P&gt;
&lt;P&gt;using namespace std;&lt;/P&gt;
&lt;P&gt;void gpib_error(int errnum, char *errmsg); //error-reporting function&lt;/P&gt;
&lt;P&gt;const int BUF_SIZE = 1024; //the size of our input/output buffer&lt;BR /&gt;const int NUM_DEVICES = 31; //maximum number of devices on the bus&lt;/P&gt;
&lt;P&gt;int main() {&lt;/P&gt;
&lt;P&gt;char buffer[BUF_SIZE];&lt;BR /&gt; int i, num_listeners; //the number of listeners on the bus&lt;BR /&gt; unsigned short address; //the address of a listener&lt;/P&gt;
&lt;P&gt;/* Arrays of possible instrument addresses, and actual addresses&lt;BR /&gt; The type Addr4882_t is a computer-dependent map to a built-in&lt;BR /&gt; data type that holds the number that is the address of a device. */&lt;BR /&gt; Addr4882_t instruments[NUM_DEVICES], result[NUM_DEVICES];&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; SendIFC(0);&lt;BR /&gt; //check for an error&lt;BR /&gt; if(ibsta &amp;amp; ERR)&lt;BR /&gt; gpib_error(1, "Could not send IFC");&lt;/P&gt;
&lt;P&gt;for(i = 0; i &amp;lt; NUM_DEVICES - 1; i++)&lt;BR /&gt; instruments[i] = i + 1;&lt;BR /&gt; instruments[NUM_DEVICES - 1] = NOADDR;&lt;/P&gt;
&lt;P&gt;cout &amp;lt;&amp;lt; "Finding all listeners on the bus..." &amp;lt;&amp;lt; endl;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; FindLstn(0, instruments, result, NUM_DEVICES);&lt;/P&gt;
&lt;P&gt;if(ibsta &amp;amp; ERR)&lt;BR /&gt; gpib_error(2, "Could not find listeners");&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; num_listeners = ibcnt;&lt;BR /&gt; result[num_listeners] = NOADDR;&lt;BR /&gt; cout &amp;lt;&amp;lt; "Found " &amp;lt;&amp;lt; num_listeners &amp;lt;&amp;lt; " devices on the bus" &amp;lt;&amp;lt; endl;&lt;/P&gt;
&lt;P&gt;SendList(0, result, "*IDN?", 5L, NLend);&lt;BR /&gt; //check for error&lt;BR /&gt; if (ibsta &amp;amp; ERR)&lt;BR /&gt; gpib_error(3, "Could not send *IDN? to devices");&lt;/P&gt;
&lt;P&gt;for(i = 0; i &amp;lt; num_listeners; i++) {&lt;/P&gt;
&lt;P&gt;Receive(0, result[i], buffer, BUF_SIZE, STOPend);&lt;BR /&gt; //check for error&lt;BR /&gt; if(ibsta &amp;amp; ERR)&lt;BR /&gt; gpib_error(4, "Could not receive from device");&lt;/P&gt;
&lt;P&gt;address = GetPAD(result[i]);&lt;/P&gt;
&lt;P&gt;buffer[ibcnt] = '\0';&lt;/P&gt;
&lt;P&gt;//Now output the results&lt;BR /&gt; cout &amp;lt;&amp;lt; "Device #" &amp;lt;&amp;lt; address &amp;lt;&amp;lt; " has ID string: " &amp;lt;&amp;lt; buffer;&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;//We're done with the program, so take the board off-line&lt;BR /&gt; ibonl (0,0);&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;void gpib_error(int errnum, char *errmsg) {&lt;BR /&gt; cout &amp;lt;&amp;lt; "Error #" &amp;lt;&amp;lt; errnum &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; errmsg &amp;lt;&amp;lt; endl;&lt;BR /&gt; ibonl(0,0); //take the board offline&lt;BR /&gt; exit(1); //terminate program&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Fri, 13 Apr 2012 02:53:11 GMT</pubDate>
    <dc:creator>wahidin</dc:creator>
    <dc:date>2012-04-13T02:53:11Z</dc:date>
    <item>
      <title>I'm getting error: invalid conversion from 'const void*' to 'void*'</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/I-m-getting-error-invalid-conversion-from-const-void-to-void/m-p/1950367#M52844</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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..&lt;/P&gt;
&lt;P&gt;The code is posted below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;#include &amp;lt;windows.h&amp;gt;&lt;BR /&gt;#include "Decl-32.h"&lt;BR /&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include &amp;lt;string&amp;gt;&lt;/P&gt;
&lt;P&gt;using namespace std;&lt;/P&gt;
&lt;P&gt;void gpib_error(int errnum, char *errmsg); //error-reporting function&lt;/P&gt;
&lt;P&gt;const int BUF_SIZE = 1024; //the size of our input/output buffer&lt;BR /&gt;const int NUM_DEVICES = 31; //maximum number of devices on the bus&lt;/P&gt;
&lt;P&gt;int main() {&lt;/P&gt;
&lt;P&gt;char buffer[BUF_SIZE];&lt;BR /&gt; int i, num_listeners; //the number of listeners on the bus&lt;BR /&gt; unsigned short address; //the address of a listener&lt;/P&gt;
&lt;P&gt;/* Arrays of possible instrument addresses, and actual addresses&lt;BR /&gt; The type Addr4882_t is a computer-dependent map to a built-in&lt;BR /&gt; data type that holds the number that is the address of a device. */&lt;BR /&gt; Addr4882_t instruments[NUM_DEVICES], result[NUM_DEVICES];&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; SendIFC(0);&lt;BR /&gt; //check for an error&lt;BR /&gt; if(ibsta &amp;amp; ERR)&lt;BR /&gt; gpib_error(1, "Could not send IFC");&lt;/P&gt;
&lt;P&gt;for(i = 0; i &amp;lt; NUM_DEVICES - 1; i++)&lt;BR /&gt; instruments[i] = i + 1;&lt;BR /&gt; instruments[NUM_DEVICES - 1] = NOADDR;&lt;/P&gt;
&lt;P&gt;cout &amp;lt;&amp;lt; "Finding all listeners on the bus..." &amp;lt;&amp;lt; endl;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; FindLstn(0, instruments, result, NUM_DEVICES);&lt;/P&gt;
&lt;P&gt;if(ibsta &amp;amp; ERR)&lt;BR /&gt; gpib_error(2, "Could not find listeners");&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; num_listeners = ibcnt;&lt;BR /&gt; result[num_listeners] = NOADDR;&lt;BR /&gt; cout &amp;lt;&amp;lt; "Found " &amp;lt;&amp;lt; num_listeners &amp;lt;&amp;lt; " devices on the bus" &amp;lt;&amp;lt; endl;&lt;/P&gt;
&lt;P&gt;SendList(0, result, "*IDN?", 5L, NLend);&lt;BR /&gt; //check for error&lt;BR /&gt; if (ibsta &amp;amp; ERR)&lt;BR /&gt; gpib_error(3, "Could not send *IDN? to devices");&lt;/P&gt;
&lt;P&gt;for(i = 0; i &amp;lt; num_listeners; i++) {&lt;/P&gt;
&lt;P&gt;Receive(0, result[i], buffer, BUF_SIZE, STOPend);&lt;BR /&gt; //check for error&lt;BR /&gt; if(ibsta &amp;amp; ERR)&lt;BR /&gt; gpib_error(4, "Could not receive from device");&lt;/P&gt;
&lt;P&gt;address = GetPAD(result[i]);&lt;/P&gt;
&lt;P&gt;buffer[ibcnt] = '\0';&lt;/P&gt;
&lt;P&gt;//Now output the results&lt;BR /&gt; cout &amp;lt;&amp;lt; "Device #" &amp;lt;&amp;lt; address &amp;lt;&amp;lt; " has ID string: " &amp;lt;&amp;lt; buffer;&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;//We're done with the program, so take the board off-line&lt;BR /&gt; ibonl (0,0);&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;void gpib_error(int errnum, char *errmsg) {&lt;BR /&gt; cout &amp;lt;&amp;lt; "Error #" &amp;lt;&amp;lt; errnum &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; errmsg &amp;lt;&amp;lt; endl;&lt;BR /&gt; ibonl(0,0); //take the board offline&lt;BR /&gt; exit(1); //terminate program&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2012 02:53:11 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/I-m-getting-error-invalid-conversion-from-const-void-to-void/m-p/1950367#M52844</guid>
      <dc:creator>wahidin</dc:creator>
      <dc:date>2012-04-13T02:53:11Z</dc:date>
    </item>
  </channel>
</rss>

