R
Richard Bos
Rick said:Hmmm, I never did this before so maybe I'm talking a bit strange. What
happens is as follow. A microcontroller with a webserver gets a string with
all kind of data that needs to be stored in the Eeprom. So I read the string
and at some point I'll get for example this : x=3,24. I know the storage
location for x so now I need to write "3,24" into the eeprom, af a float so
there are 4 bytes reserved for that. I can't just say, eeprom_write(
somedata ); so I need to convert that float, at least, that's what I think,
as I said, never did it before.
Ah, you want to convert _text_ to a floating point value! That's a
different problem from what you described in the first post.
Normally, you'd use strtod() for this. Before we had strtod(), you'd use
atof(). The problem here is that both strtod() and atof() are in
<stdlib.h>, and a freestanding implementation (which I suspect is what
you may be using) is not required to supply <stdlib.h>.
If I were you, I'd first check that, maybe, it does provide <stdlib.h>,
in particular strtod(), after all; you may be in luck. If not, I'm
afraid you'll just have to parse the text by hand. It's not _that_
difficult.
Richard