On Mon, 6 Jul 1998, Ibrahim F Haddad wrote:
>I have a file 'value' that contains a float of the form 1.23464
>I need to read it and store it in a variable of type float called
> norme.
>it did not work!
>So i read it as string and now i need to convert the string back
>to float
Why don't you read it back into a float instead of a string?
fscanf(filePtr, "%f", &norme)
C can't do automatic type conversion to/from strings. You need to use
functions like strtod or sscanf when doing string->value conversions.
(the atoX faily mentioned by others is not standard C, but is available
on most UNIX and some other platforms)
---
Henrik Nordström