Re: gtk_init breaks fortran data operation

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

 



Yes, you are right. Adding
>setlocale(LC_NUMERIC, "en_US.utf8");
after gtk_init solved the problem.
Thanks a lot!

28.11.2010 17:58, Jean BrÃfort ÐÐÑÐÑ:
> gtk_init sets the locale. I suppose that the data file contains the
> numbers as strings. If your locale uses a comma as decimal separator,
> the parser can't interpret the dot and just loads the integer part of
> the first number.
>
> Regards,
> Jean
>
> Le dimanche 28 novembre 2010 Ã 17:20 +0300, Alexander Varnin a Ãcrit :
>> Hello.
>> I'm writing an application, that combines GTK calls (from C source)
>> and fortran subroutine.
>> Behavior of subroutine depends on when it gets called - before
>> gtk_init or after.
>> If it is called before gtk_init, subroutine works OK. If subroutine is
>> called after gtk_init, fortran behaves very strange: it reads floating
>> point value from file, but it gets only integer part of it. In first,
>> correct case, it reads normal floating point value.
>>
>> Code
>>> printf("This call is correct:\n");
>>> main_in_ ();
>>> gtk_init (&args_length1, &args);
>>> printf("And this is already broken:\n");
>>> main_in_ ();
>> Gives following output
>>> This call is correct:
>>> dt ==   7.30000019E-11
>>> And this is already broken:
>>> dt ==    7.0000000 
>> Why does gtk_init affect fortran way of reading value? How it can be
>> fixed?
>> Small testcase attached.
>> _______________________________________________
>> gtk-list mailing list
>> gtk-list@xxxxxxxxx
>> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux