Send 0x0 for serial port

forum.td.development (2005-2010)
fausto.lupercio
Ecuador
Posts: 57
Joined: 18 Sep 2017, 15:38
Location: Quito

Send 0x0 for serial port

Post by fausto.lupercio » 26 Jan 2010, 00:33

 Posted by:  Fausto Lupercio 

Hi, I ned send a Hexadecimal number for serial por, one is 0x0...for this no
funtions,
Please can you help me:

EX:

Set sComando =
SalNumberToChar( 0x02 ) ||
SalNumberToChar( 0x04 ) ||
SalNumberToChar( 0x04 ) ||
SalNumberToChar( 0x8A ) ||
SalNumberToChar( 0x00 ) ||
SalNumberToChar( 0x01 ) ||
SalNumberToChar( 0x11 ) ||
SalNumberToChar( 0x23 )

In the port send: 02 04 04 8A 01 11 23
And i need send: 02 04 04 8A 00 01 11 23

Thanks in adavence.

Jim McNamara

Send 0x0 for serial port

Post by Jim McNamara » 26 Jan 2010, 14:38

 Posted by:  Jim McNamara 

In TD (and C, C+, C#) 0x00 is a string terminator. Concantinating the the
character won't work.

You need to attach the cstruct.apl to your app, declare a string buffer,
then use the cstruct.apl function CStructPutByte(...) to populate the the
buffer. - And cross your fingers. The last time I had to deal with this
issue, I ended up building a VB .dll to get the job done.

Return to “td.development”

Who is online

Users browsing this forum: [Ccbot] and 0 guests