Hi!
My problem looks like this:
#include <iostream>
#include <locale>
int main(int argc, char* argv[])
{
std::locale::gl obal( std::locale( "deu" ) );
std::cout.imbue ( std::locale() );
std::cout << 1000.4 << " " << 0.4 << std::endl;
return 0;
}
This is MS VC++ 7.1 here (explains the "deu" locale, it's the same with
"german").
Output is:
1,000.4 0,4
Now, this is confusing! I really expected
1.000,4 0,4
Any suggestions?
Regards,
M. Kluwe 2 1571
Matthias Kluwe skrev: Hi!
My problem looks like this:
#include <iostream> #include <locale>
int main(int argc, char* argv[]) { std::locale::gl obal( std::locale( "deu" ) ); std::cout.imbue ( std::locale() ); std::cout << 1000.4 << " " << 0.4 << std::endl; return 0; }
This is MS VC++ 7.1 here (explains the "deu" locale, it's the same with "german").
Output is:
1,000.4 0,4
Now, this is confusing! I really expected
1.000,4 0,4
Shouldn't you at least be expecting 1.000,4 0,4 ?
I don't know what sort of function imbue() is
but it seems it just formats the numbers
as if it were financial calculations. Any suggestions?
Regards, M. Kluwe
> Matthias Kluwe skrev: [...]
Now, this is confusing! I really expected
1.000,4 0,4
Shouldn't you at least be expecting 1.000,4 0,4 ?
Didn't I say that?
I don't know what sort of function imbue() is but it seems it just formats the numbers as if it were financial calculations.
What sort of? Member of ios, I think. Should imbue (!) the stream with
the given locale ...
Anyway, I just checked with gcc 3.3.5 with the expected result, so
maybe I should consult a VC++ specific group.
Regards,
Matthias This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Timothy Smith |
last post by:
hi there i need to set my locale so that when i output a number it's
formatted with thousands grouped. the problem i've found is there
doesn't seem to be very good cross platform support for locales, even
between unix's it's horrid.
|
by: Roger Leigh |
last post by:
Hello,
I'm writing a fixed-precision floating point class, based on the ideas
in the example fixed_pt class in the "Practical C++ Programming" book
by Steve Oualline (O' Reilly). This uses a long int to store the
value, and the precision (number of decimal points) is variable (it's
a templated class):
template <size_t _decimal_places = 4>
class FixedFloat {
|
by: sprotty |
last post by:
I'm writting some classes that deal with XML, and they need to be able
to convert from strings to doubles and back.
The problem is they should only accept/output strings valid in XML,
that is using the '.' as the decimal separator (ie '123.12').
Ive been using atof etc, but as soon as you install on a foregin
machine, you start getting numbers that look like '12,343,243' or
'32432,98' etc. These are not valid in XML documents, and thus...
|
by: Matthias Kluwe |
last post by:
Hi!
My problem looks like this:
#include <locale>
#include <iostream>
int main(int argc, char* argv)
{
std::locale::global( std::locale( "deu" ) );
|
by: gelbeiche |
last post by:
I have a question regarding the following
small C program.
#include <locale.h>
int main()
{
char* loc = 0;
char before,after;
int i;
| |
by: |
last post by:
Hi all,
running the following code as an console application:
#include <locale>
#include <iostream>
#include <sstream>
#include <tchar.h>
using namespace std;
|
by: Daniele C. |
last post by:
I will report a snippet from http://php.net/setlocale
I spent about 2 seconds before thinking: can it really be? I mean, is
there no way to set locale info per thread? And after a brief web
search I came up with this keyword: _configthreadlocale
Read more at http://msdn2.microsoft.com/en-us/library//26c0tb7x(VS.80).aspx
(beware, this page is very slow or their servers are anyway).
Looks like this function exists since Windows 95 and...
|
by: Noah Roberts |
last post by:
A lot of my code converts numeric values to strings using
boost::lexical_cast, and thus, underneath, with <<. When I activate
locales, the thousands separator turns on.
We've deemed it not worthwhile to enable the various input elements to
use thousands separators and so I need to make sure those elements are
never initially filled with them, otherwise the user will never be able
to edit them.
How can I shut this off? I am using my...
|
by: Mario Ruggier |
last post by:
Hi,
i had the following problem when installing py3.0rc1 on a Mac OS X
10.5.5. On this system, the default locale values are:
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |