On 7 Dec 2003 01:17:36 -0800, in comp.lang.c ,
bcg008@mot.com (Golan)
wrote:
[color=blue]
>Hi,
>I need to convert a Binary value to Decimal.[/color]
in computers,. all numbers are binary. If your "binary number" is
stored in a numerical data type then you don't need to do anything..
[color=blue]
>I've been told that the
>value is an unsigned one. How can I do this?[/color]
is your "binary" data in a string? Or in a numeric type? Sounds like
the latter. So its already a number, you only need to printf it using
the right format specifier.
[color=blue]
>I use memcpy into an unsigned char variable, but when I print the
>value I got a negative value.[/color]
if you printf an unsigned char array, you should get a string, not a
number !! What /are/ you doing?
[color=blue]
>For example if I'm using the xd -c (Unix) on the file, I can see the
>value FFFFFFFFFFFFFFA2 which using the memcpy as described above I get
>-94.[/color]
Show us your code for goodness sake !
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---