Binary value of an integer

Binary value of an integer

Postby gkuhnert » Mon Jan 31, 2011 3: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
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Binary value of an integer

Postby nageswaragunupudi » Mon Jan 31, 2011 3:40 pm

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Binary value of an integer

Postby gkuhnert » Mon Jan 31, 2011 4: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
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Binary value of an integer

Postby nageswaragunupudi » Mon Jan 31, 2011 4:12 pm

Works for me with xHarbour and linking with ct.lib
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Binary value of an integer

Postby gkuhnert » Mon Jan 31, 2011 4: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
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 70 guests