LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

viOpen with string variable

Please can any help -
 
I am trying to use use a string variable 'IP_Address' in the viOpen command structure
 
status = viOpen (defaultRM, "TCPIP0::192.168.10.50::inst0::INSTR", VI_NULL, VI_NULL,&Generator);
 
so that the hard-coded ip address 192.168.20.50 can be a variable read into 'IP_Address'  from user input.
 
I have tried formatting 'IP_Address' to contain "TCPIP0::192.168.10.50::inst0::INSTR" and then using:
 
viOpen (defaultRM, IP_Address, VI_NULL, VI_NULL,&Generator);
 
but get an error 'Invalid Resource Reference'.
 
Is there any way of accomplishing this?
 
Many thanks,
 
Allen Cherry
0 Kudos
Message 1 of 5
(3,645 Views)

Your idea should work. There must be a detail wrong, which is not  included in your description.

A guess:

What is the size of the IP_Address string ? Might it be that it misses the space for  terminating \0 char?

 

 

0 Kudos
Message 2 of 5
(3,640 Views)
Hi,
 
"TCPIP0::192.168.10.50::inst0::INSTR"
 
The inst0 should be the LAN device name of the instrument.
If you are using the default I think you can leave it out
eg
"TCPIP0::192.168.10.50::INSTR"
 
Regards
Ray farmer
Regards
Ray Farmer
0 Kudos
Message 3 of 5
(3,635 Views)
Markus,
 
Many thanks - your guess was correct!!
 
Allen
0 Kudos
Message 4 of 5
(3,620 Views)

Ray,

 

Yes - it does work leaving out the '::inst0'.

 

Thanks for your help,

 

Allen

0 Kudos
Message 5 of 5
(3,618 Views)