Problems with "atof" from <cstring> library



Hello,

I've got a strange problem with gtkmm. In the following there are two little programms which are mainly the same, but just changed the position of "Gtk::Main kit(argc, argv);" The results are different. The first version does it right. The second not. Why?

Best Regards,

Wätzold


=========== BEGIN ============


#include <cstring>
#include <gtkmm/main.h>
#include <iostream>

using namespace std;


int main(int argc, char *argv[])
{
 
    char cha[] = "0.5";
    double mass_;
    cout << "\nCha: " << cha << endl;
    mass_ = atof( cha );
    cout << "mass: " << mass_ << endl;
    
  Gtk::Main kit(argc, argv);



    //MainWindow mainwindow;
    //Gtk::Main::run(mainwindow); //Shows the window and returns when it is closed.

  return 0;
}
======== END 1===========

#include <cstring>
#include <gtkmm/main.h>
#include <iostream>

using namespace std;


int main(int argc, char *argv[])
{
 
    
  Gtk::Main kit(argc, argv);

    char cha[] = "0.5";
    double mass_;
    cout << "\nCha: " << cha << endl;
    mass_ = atof( cha );
    cout << "mass: " << mass_ << endl;
 


    //MainWindow mainwindow;
    //Gtk::Main::run(mainwindow); //Shows the window and returns when it is closed.

  return 0;
}
==========END 2===========


Telefonieren Sie ohne weitere Kosten mit Ihren Freunden von PC zu PC!
Jetzt Yahoo! Messenger installieren!

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