FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Binary value of an integer
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Binary value of an integer
Posted: Mon Jan 31, 2011 03:13 PM

Hi,

is there any way to convert an integer to its binary value?

like dec2bin(5) = 101 ?

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Binary value of an integer
Posted: Mon Jan 31, 2011 03:40 PM

NtoC( 5, 2 ) --> '101'

Regards



G. N. Rao.

Hyderabad, India
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: Binary value of an integer
Posted: Mon Jan 31, 2011 04:00 PM

Doesn't work for me :cry:
msginfo( NtoC( 5, 2 )) ==> '5'

is there something I need to configure?

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Binary value of an integer
Posted: Mon Jan 31, 2011 04:12 PM

Works for me with xHarbour and linking with ct.lib

Regards



G. N. Rao.

Hyderabad, India
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: Binary value of an integer
Posted: Mon Jan 31, 2011 04:18 PM

Rao,

thanks a lot! I've found the problem: There was a function NtoC implemented in my program which had overwritten the original function!

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de

Continue the discussion