Binary to Decimal function 
Author Message
 Binary to Decimal function

Is there a function in the math.h or any other that will convert a number in
binary to decimal?  If so, what header must I import and what is the syntax
for its use?

Thanks.
--



Tue, 25 Mar 2003 12:33:43 GMT  
 Binary to Decimal function

Quote:

> Is there a function in the math.h or any other that will convert a number in
> binary to decimal?  

Please not that 'number' is a somewhat ambiguous term. In C, there's at
least three types of things you might be meaning by this:

1) A numeric constant contained in the source code.
2) The value of a numeric-type variable.
3) A string representation of 2).

Of these, only 1) and 3) can meaningfully be said to be 'decimal', or
converted to or from decimal to some other system. A variable value is
in *no* particular system --- it's stored in whatever shape the CPU
wants it.

As to you question: check out strtol("0010101", NULL, 2), followed by
a printf("%d",...) call. Find out the details yourself, please.
--

Even if all the snow were burnt, ashes would remain.
--



Tue, 25 Mar 2003 03:00:00 GMT  
 Binary to Decimal function

Quote:
>Is there a function in the math.h or any other that will convert a number in
>binary to decimal?  If so, what header must I import and what is the syntax
>for its use?

>Thanks.

sprintf in stdio.h

<<Remove the del for email>>
--



Wed, 26 Mar 2003 13:45:57 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Binary to Decimal Function

2. Convert from binary to decimal, hex to decimal etc

3. Display Binary Equivalent To Decimal Value

4. Hexadecimal to binary, decimal in c#

5. Binary to decimal

6. Decimal, Hex, and Binary

7. decimal to binary

8. decimal to binary

9. binary to decimal question

10. conversion decimal<->binary

11. how to convert numbers in decimal to binary?

12. Binary to decimal conversion.

 

 
Powered by phpBB® Forum Software