Complete.Org: Mailing Lists: Archives: discussion: May 2000:
[aclug-L] Re: C question or Sometimes it's the simplest things...
Home

[aclug-L] Re: C question or Sometimes it's the simplest things...

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: discussion@xxxxxxxxx
Subject: [aclug-L] Re: C question or Sometimes it's the simplest things...
From: Steven Saner <ssaner@xxxxxxxxxxxxxxx>
Date: Fri, 5 May 2000 10:18:13 -0500
Reply-to: discussion@xxxxxxxxx

That is correct. (s)printf will convert a number to octal or
hexadecimal, but it doesn't look like it converts to binary. One thing
to consider is using sprintf to convert to a hexadecimal string and
then convert that to binary since each hex digit converts cleanly to 4
binary digits.


On Fri, May 05, 2000 at 09:42:05AM -0500, Jeff wrote:
> On Fri, 5 May 2000, Larry Bottorff wrote:
> 
> > I need to take an int and convert it to store/display as a binary
> > string. That is, if I have 35 in need to store it as the char array
> > 100011. Is there some simple function I'm not aware of?
> 
> Don't think (s)printf does it ... I'd just write a loop.
> 
> -jeff
> -- 
> "Consistently separating words by spaces became a general custom about
> the tenth century A.D., and lasted until about 1957, when FORTRAN
> abandoned the practice." - Sun FORTRAN Reference Manual
> 
> 
> -- This is the discussion@xxxxxxxxx list.  To unsubscribe,
> visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi

-- This is the discussion@xxxxxxxxx list.  To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi


[Prev in Thread] Current Thread [Next in Thread]