LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Send a \x00

Hello,

I want to pilot a relay ch380 with CVI but to open the relay, I need to send this : \xA0\x01\x00\xA2 .
But CVI interpret the \x00 like a end of string of characters.

I try to use memcpy beacause i see someone with the same problem but that dont work.

Can someone help me please

Lucas

 

(sorry for my bad english)

 

0 Kudos
Message 1 of 2
(400 Views)

Yes, 0x00 character marks the end of a string so every function that handles strings will fail.

You must double check your code to exclude all of them: using memcpy can be of help, but you must also avoid using strlen () to determine the number of bytes to send.

Just as an example, supposing to use serial communications (but this applies also to other channels):

char	string[8];

string[0] = 0xA0;
string[1] = 0x01;
string[2] = 0x00;
string[3] = 0xA2;
ComWrt (port, string, strlen (string));	// This will fail
ComWrt (port, string, 4);				// This will succeed

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 2
(361 Views)