Hello, Ibrahim!
On Mon, 6 Jul 1998, Ibrahim F Haddad wrote:
>as easy as it may seem (!) it is not working with me
>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
>as in:
> filePtr = fopen ("value", "r");
>
> if ( filePtr == NULL)
> {
> printf ("Not found!\n");
> }
> else
>
>{
> fscanf (filePtr, "%s", polynorme);
> printf (" Got it a string %s
>\n", polynorme);
> fclose (filePtr);
> }
>Up till here it worked.
>
>but,
> norme = (float) polynorme;
> printf (" Got it as
>float !! %d \n", norme);
>
>castind did not work.
>
>Any ideas how to make it run!
Argh. (float) unsigned char* should not work.
There is a family of atoX functions, and you should take atof(3)
Bye.
--
Woman: "Is Yoo-Hoo hyphenated?"
Yogi Berra: "No, ma'am, its not even carbonated."
--
With best of best regards, Pawel S. Veselov (aka Black Angel)
Internet e-mail : [EMAIL PROTECTED]
Web page : http://www.druid.ml.org/~vps/ | ICQ UIN : 5252265