🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7974

Re: Obtaining the Currency Symbol

#7974
From: Vladimir Stefanovic
Date: Fri, 10 Dec 2004 13:52
140 lines
4464 bytes
You can use some global data already (with no coding)

All this is copied from:
http://www.vanwijk.com/-%3D%20Bookz%20%3D-/C++%20Builder%20Unleashed/h
tm/ch03.htm

<quote>
The format used in this case is global to the system. You can change
these settings
by working with a series of global variables found in SYSUTILS.HPP:

extern System::AnsiString CurrencyString;
extern unsigned char CurrencyFormat;
extern unsigned char NegCurrFormat;
extern char ThousandSeparator;
extern char DecimalSeparator;
extern unsigned char CurrencyDecimals;
extern char DateSeparator;
extern System::AnsiString ShortDateFormat;
extern System::AnsiString LongDateFormat;
extern char TimeSeparator;
extern System::AnsiString TimeAMString;
extern System::AnsiString TimePMString;
extern System::AnsiString ShortTimeFormat;
extern System::AnsiString LongTimeFormat;
extern System::AnsiString ShortMonthNames[12];
extern System::AnsiString LongMonthNames[12];
extern System::AnsiString ShortDayNames[7];

extern System::AnsiString LongDayNames[7];

On my system, these values are preset as follows:

CurrencyString: $
CurrencyFormat: 0
NegCurrFormat: 0
ThousandSeparator: ,
DecimalSeparator: .
CurrencyDecimals: 2
DateSeparator: /
ShortDateFormat: M/d/yy
LongDateFormat: dddd, MMMM dd, yyyy
TimeSeparator: :
TimeAMString: AM
TimePMString: PM
ShortTimeFormat: h:mm AMPM
LongTimeFormat: h:mm:ss AMPM
ShortMonthNames: Jan
ShortMonthNames: Feb
ShortMonthNames: Mar
ShortMonthNames: Apr
ShortMonthNames: May
ShortMonthNames: Jun
ShortMonthNames: Jul
ShortMonthNames: Aug
ShortMonthNames: Sep
ShortMonthNames: Oct
ShortMonthNames: Nov
ShortMonthNames: Dec
LongMonthNames: January
LongMonthNames: February
LongMonthNames: March
LongMonthNames: April
LongMonthNames: May
LongMonthNames: June
LongMonthNames: July
LongMonthNames: August
LongMonthNames: September
LongMonthNames: October
LongMonthNames: November
LongMonthNames: December
ShortDayNames: Sun
ShortDayNames: Mon
ShortDayNames: Tue
ShortDayNames: Wed
ShortDayNames: Thu
ShortDayNames: Fri
ShortDayNames: Sat
LongDayNames: Sunday
LongDayNames: Monday
LongDayNames: Tuesday
LongDayNames: Wednesday
LongDayNames: Thursday
LongDayNames: Friday
LongDayNames: Saturday

For instance, the following code changes the nature of the current
ShortDateFormatString:

void __fastcall TForm1::SetShortDateFormattoMMMMDDDDYYYY1Click(TObject
*Sender)

{
  RichEdit1->Text = Now();
  ShortDateFormat = "MMMM/DDDD/YYYY";
  RichEdit1->Lines->Add(Now());
}

The text displayed by calling this function is as follows:
1/7/97 1:30:21 PM

January/Tuesday/1997 1:30:21 PM

The first block of text shows the default behavior, and the second
block
shows what happened after I made a few subtle changes to the system.

The system initializes the date and time strings to the choices you
make
in Windows. You can see the current Windows settings by calling
GetLocaleInfo. Changes you make are written to the system registry if
you
send a WM_INICHANGE message to your own nonconsole mode application.


</quote>


Best regards,
Vladimir Stefanovic

<Roger Warren> wrote in message
news:41b9992f$1@newsgroups.borland.com...
> Hi,
>
> How can I obtain the currency symbol for the currenct
locale/regional
> setting? I have tried using:
>
> ...
> struct lconv ll;
> struct lconv *conv = &ll;
> conv = localeconv();
> printf("Currency symbol: %s\n", conv->currency_symbol);
> ...
>
> But it doesn't seem to produce anything.
>
> Any help would be appreciated. Thanks.
>
Technical Details
Message-ID: <41b9aa90@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41b9992f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5c552075733153e4,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <spam@not.needed>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41b9992f$1@newsgroups.borland.com>
Subject: Re: Obtaining the Currency Symbol
Date: Fri, 10 Dec 2004 14:52:40 +0100
Lines: 142
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
NNTP-Posting-Host: 213.137.116.189
Message-ID: <41b9aa90@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1102686864 213.137.116.189 (10 Dec 2004 05:54:24 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail