code work wrong when i put it in gtk+ application



After i updated my system my previously working gtk+ application start to print wrong result.The problem is 
atof() i used in the program.The code is working as expected in a standart c console version.(Program reads 
some datas from file and make some calculations)The code i used is;

suppose that at line 62 the file have data;
10   5  15 B   15.031103

the code;

gchar *temp,cm[11];
gfloat m;
gint l00;
.....

while(!feof(in)){
fgets(temp,30,in);



for(i=0;i<10;i++) cm[i]=temp[i+15];

cm[10]='\0';
if(l==62) g_print("mass=%s\n",cm);/*prints 15.031103  */

m=atof(cm);

if(l==62) g_print("mass=%f\n",m);/*prints 15,000000 notice that not   15.000000
                         it prints with the comma 15,000000 */
l++;
}

I also tried sscanf(cm,"%f",&m) and m=strtof(cm,NULL);
always gives 15,000000 When i try exactly the same code in a standart c program it is working as expected.


      



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]