0

I have written an App with QT for Android. This is a test App and I found accidentally that when I call the function atof() the App crashes at my Samsung s3.

This is the error:

W/dalvikvm(23038): threadid=1: thread exiting with uncaught exception (group=0x417acda0) E/AndroidRuntime(23038): FATAL EXCEPTION: main E/AndroidRuntime(23038): Process: org.qtproject.example.App_Android, PID: 23038 E/AndroidRuntime(23038): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "atof" referenced by "libApp_Android.so"...

and the code is:

char str[20]; strcpy(str, "98993489");
val = atof(str);

from tutorialpoint.com.

Why do I have this issue? How can I solve it?

masoud
  • 55,379
  • 16
  • 141
  • 208
xmaze
  • 41
  • 1
  • 9
  • 3
    Any reason you can't switch to `std::string` and use [`std::stod`](http://en.cppreference.com/w/cpp/string/basic_string/stof)? – Cory Kramer Feb 17 '15 at 20:06
  • If you use Qt then use Qt API: [toDouble](http://doc.qt.io/qt-5/qstring.html#toDouble) [toFloat](http://doc.qt.io/qt-5/qstring.html#toFloat). – Marek R Feb 17 '15 at 21:27

0 Answers0