Help with CHR(0)

Post Reply
User avatar
Adolfo
Posts: 815
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile
Contact:

Help with CHR(0)

Post by Adolfo »

Hi everybody..
Need to know what's the difference between VB's 6.0 CHR and Clipper/Harbour/xHabour's one

I have a VB sample which comunicates with an OCX

Ex.

data= chr(0)
fe.addDataField data

In harbour/xHarbour

data:= Chr(0)
Ef:Do("addDataField",data)

Both are supposed to add some data to a string which is sent to a Com port.

BUT.......
If I use PortMon to monitor the com port, I can see that in VB the field is added with "00" in the string sent to the port, but in xHarbour sample, this part is missing, so It fails.
I read about Chr(0) in the NG's and I understand that it is equivalent to a null character, but I need to know the ASCII character code for 0 ( cero )

Any way to do it

Thanks in advance...
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
User avatar
tnhoe
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia
Contact:

Post by tnhoe »

'0' = chr(asc('0'))
Regards

Hoe, email: easywin3@yahoo.com
User avatar
goosfancito
Posts: 1392
Joined: Fri Oct 07, 2005 7:08 pm

Post by goosfancito »

tnhoe wrote:'0' = chr(asc('0'))
Adolfo,

if you need to send a string with chr(0) then:

'0' == chr( asc( '0' ) )

but... chr( 0 ) != '0'

:wink:
Un aporte chico hace grandes cambios.
Apoyemos al proyecto "Hogar pimpinela"
Bajate la aplicación (gratuita) y encuentra en ella toda la info de como podes colaborar.
GRACIAS!
https://play.google.com/store/apps/deta ... .acomprar
Post Reply