Oops, I forgot: add "#include <QLocale>" somewhere at the top (e.g. below #include <QMutexLocker>) ________________________________________ De : plplot-devel-boun...@lists.sourceforge.net [plplot-devel-boun...@lists.sourceforge.net] de la part de Werner Smekal [sme...@iap.tuwien.ac.at] Date d'envoi : mardi 1 septembre 2009 09:47 À : Alan W. Irwin Cc : Plplot-devel mailing list; Hazen Babcock Objet : Re: [Plplot-devel] Qt driver update
Hi, > I think I found out what the problem is. The first page reads okay, > but then qt takes over to show the plot and somehow changes the locale > or something. This is on a Mac, English version, but Austrian locale - > so after that scanf expects floating point numbers to be written > numbers like 3,1415 and not 3.1415. scanf fails then on the numbers. I > assume that this is the problem, since I printed the out the numbers > with printf in case sscanf fails and the output is: > > 0: 0.0 0.0 0.0 0.0 1.0 0 > 1: 1.0 1.0 1.0 1.0 1.0 0 > 0: 0.0 1.0 1.0 1.0 1.0 0 > 0,000000, -0,000000, 0,000000. 0,000000, 0,000000, 3075440 > > *** PLPLOT WARNING *** > Unrecognized cmap1 format (wrong number of items (1) for version 2 of > format) 0.0 1.0 1.0 1.0 1.0 0 > > I'll try now to play around with my locale. The other Mac has also > Austrian locale, but obviously Qt cocoa doesn't mess around here. Ok, this is the problem. Qt carbon changes the locale and sscanf doesn't work as expected any more. If I add setlocale(LC_NUMERIC, "C"); just before the sscanf call, everything works as expected. This is obviously not the correct solution but at least we know what is going wrong. Also if I change my locale to UK the example works as expected. Regards, Werner -- Dr. Werner Smekal Institut fuer Allgemeine Physik Technische Universitaet Wien Wiedner Hauptstr 8-10 A-1040 Wien Austria email: sme...@iap.tuwien.ac.at web: http://www.iap.tuwien.ac.at/~smekal phone: +43-(0)1-58801-13463 (office), +43-(0)1-58801-13469 (laboratory) fax: +43-(0)1-58801-13499 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel