User forums > Using Code::Blocks
fscanf and numbers
os.555:
Hi,
I somehow changed the settings in Code::Blocks (I honestly dont know how..) and now fscanf and fprintf functions represent the double numbers with comma instead with point - e.g 48695,8795 is number and fscanf reads it whole and store, but 48695.8795 is not a number and fscanf reads only the part 48695 and then place the comma after it and fill the rest with zeros. fprintf prints doubles also with commas and not with points. I dont know what I've done (I've just included gtk.h and glade. h in my main.cpp - that's all), cause in the beginning everything in this project worked just fine.
Any help?
Thanks
Belgabor:
Did you change to wxWidgets-trunk (2.9)? I had the very same problem when I did as it now sets the locale properly so all standard functions respect the local settings. If you need to always use a decimal point, either set the locale to English somewhere at the start of your program or forget using scanf/printf and use boost as I did.
os.555:
--- Quote from: Belgabor on May 01, 2008, 05:23:11 pm ---Did you change to wxWidgets-trunk (2.9)?
--- End quote ---
I don't know, what it is, so I suppose the answer is no.
--- Quote from: Belgabor on May 01, 2008, 05:23:11 pm ---...either set the locale to English somewhere at the start of your program...
--- End quote ---
Like where? I'm very unexperienced in these things, so I would like you to be more specific (imagine you are explaining something to complete idiot:) ).
Belgabor:
well, I just use
--- Code: ---wxLocale loc(wxLANGUAGE_ENGLISH);
--- End code ---
Do that somewhere after wxWidgets initializes and where it is alive as long as your app is. I so far only need it in a console app, so I'm not 100% sure where to put it for a GUI app, but I'd try the OnRun() handler of your wxApp class. Maybe someone else has a better suggestion.
os.555:
--- Code: ---wxLocale loc(wxLANGUAGE_ENGLISH);
--- End code ---
When I use this line I get this error: "wxLocale was not declared in this scope"
In my application I use only gtk for interface, not wxWidget...
Navigation
[0] Message Index
[#] Next page
Go to full version