Re: converting to bits
From: Andreas Kahari (ak+usenet_at_freeshell.org)
Date: 11/12/03
- Next message: Rick: "Re: converting to bits"
- Previous message: Rick: "converting to bits"
- In reply to: Rick: "converting to bits"
- Next in thread: Rick: "Re: converting to bits"
- Reply: Rick: "Re: converting to bits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 12 Nov 2003 10:24:48 +0000 (UTC)
In article <3fb206c9$0$58712$e4fe514c@news.xs4all.nl>, Rick wrote:
> Hi,
>
> Does C have some handy functions to convert chars, ints and floats to bit
> arrays? I need to store that stuff binary so a few functions would be great.
> Converting chars and ints isn't difficult but floats are giving me a
> headache. And how about converting them back?
> I need a function like :
> <bitarray> convertFloatToBits( <number>, <signed or not>, <length
> default at 32 bits> )
> By the way, the C program has to be suitable for a microcontroller so I only
> have acces to the basic libraries.
If I'm not terribly wrong, most machines already store all
datatypes as binary.
If you calculate all the ones and zeroes of an integer or
floating point value, what type of array would you want to store
them in? An int array? That kind'a defeats the purpose of the
execise, don't you think?
Are you not happy with writing the floats and whatnot to a
binary file, or do you want to write character ones and charater
zeroes to a text file?
-- Andreas Kähäri
- Next message: Rick: "Re: converting to bits"
- Previous message: Rick: "converting to bits"
- In reply to: Rick: "converting to bits"
- Next in thread: Rick: "Re: converting to bits"
- Reply: Rick: "Re: converting to bits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|