Instructions
Chapter 5 Programming Examples  RIGOL 
RSA3000E Programming Guide  5-25 
bool bReadOK = false; 
unsigned char RecBuf[MAX_REC_SIZE]; 
string str; 
memset(RecBuf,0,MAX_REC_SIZE); 
result=char*)malloc(MAX_REC_SIZE*sizeof(char)); 
memset(result,0,MAX_REC_SIZE); 
//Address conversion, convert the string type to char* 
SendAddr=const_cast<char*>(strAddr.c_str()); 
//Turn on the VISA device 
status = viOpenDefaultRM(&defaultRM); 
if (status < VI_SUCCESS) 
{  
// Error Initializing VISA...exiting  
cout<<"No VISA equipment!"<<endl; 
return false; 
} 
//Turn on the specified device 
status = viOpen(defaultRM, SendAddr, VI_NULL, VI_NULL, &instr); 
//Read from the device 
status = viRead(instr, RecBuf, MAX_REC_SIZE, &retCount); 
//Turn off the device 
status = viClose(instr); 
status = viClose(defaultRM); 
sprintf(result,"%s",RecBuf); 
pstrResult = result; 
free(result); 
return bReadOK; 
} 
void makeupper( string &instr) 
{ 
string outstr = ""; 
if(instr == "") 
{ 
exit(0); 
} 
for(int i = 0;i < instr.length();i++) 
{ 
instr[i] = toupper(instr[i]); 
} 
} 
3.  Edit the function file mainloop.cpp to complete the flow control. 
#include "DemoForRSA.h" 
void menudisplay() 
{ 
cout<<"\t\t  Please operate the instrument:\n read write quit"<<endl; 
} 










