0
#include <qapplication.h>
#include <qmainwindow.h>
#include "mainwindow.hpp"
#include "../RegisterOfErrors.hpp"
#include <clocale>
extern std::string* Error::DescriptionOfErrors;
int main (int argc, char *argv[])
{
std::locale::global(std::locale("en_US"));
setlocale(LC_ALL, "en_US");
FILE *conf = fopen("dupa.txt", "r");
float dupa;
fscanf(conf, "%f", &dupa);
printf("%f\n", dupa);
Error::setDescriptionOfErrors();
QApplication app(argc, argv);
MainWindow window;
window.show();
return app.exec();
}
我的默认语言环境是“es_ES”,所以“,”是小数点。 这是我的代码。在文件“dupa.txt”是一个数字“1.0344”,它的工作正常。然而,在代码中,我使用的是fann库,它在g ++中通过“-ldoublefann”链接,并从文件中读取一些数据,而在这个库中只能使用“,”。看起来setlocale()在链接库中不起作用
为什么有人会低估这个问题? – 2012-08-02 09:11:11