Decimal to binary
Hi,
Does anyone know of a function which would convert a decimal number into its equivalent binary(8bits) string. I was on windows and was using itoa, however this functin is no where to be found on my linux system. Thanks maldini |
Code:
{ |
Hi, I just tried the piece of code you sent me and what this code seems to do, is to convert the interger into a string. what i need is something that you pass it the number 7 for example and it will return you 00000111.
Let me know what you think Thanks for the help |
I didn't realize itoa() did that for you. It wouldn't be hard to create a function to do that...give me a sec.
|
Here you go:
Code:
itsme@dreams:~/C$ cat ctob.c Code:
itsme@dreams:~/C$ ./ctob |
try something like this
Code:
#include <limits.h> |
thanks guys, I was sure there was a function part of a linux library which did this. I guess some things are better done from scratch. Thanks a lot guys.
maldini |
All times are GMT -5. The time now is 11:21 PM. |