 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Robert G. Hoover Guest
|
Posted: Wed May 16, 2007 10:22 pm Post subject: Regional Settings and sprintf? |
|
|
Hi All,
If I use AnsiString::ToDouble(), then this will convert a floating point number
string to a 'float' as per my Regional Settings. For example, if an American
user inputs "5.2" I get 5.2 and if a European user inputs "5,2" I get 5.2. No
problem here.
However, I'm using String("").sprintf("%.03f", MyFloat) to convert back to a
string for output. I get "5.200" independent of Regional Settings. I assume this
is because the sprintf doesn't take these global settings into account. If I use
StrToFloat, I end up with something like "5.200000384". I am using sprintf so I
can limit the number of significant digits displayed. Is there a way to limit my
sigdigs and utilize the global Regional Settings of Windows?
Many thanks,
Rob |
|
| Back to top |
|
 |
Bob Gonder Guest
|
Posted: Wed May 16, 2007 11:34 pm Post subject: Re: Regional Settings and sprintf? |
|
|
Robert G. Hoover wrote:
| Quote: | However, I'm using String("").sprintf("%.03f", MyFloat) to convert back to a
I end up with something like "5.200000384". I am using sprintf so I
can limit the number of significant digits displayed. Is there a way to limit my
sigdigs and utilize the global Regional Settings of Windows?
|
How about FloatToStrF() ? |
|
| Back to top |
|
 |
Robert G. Hoover Guest
|
Posted: Fri May 18, 2007 2:08 am Post subject: Re: Regional Settings and sprintf? |
|
|
Hi Bob,
Excellent! That did the trick. It's amazing how you look through the list of
available functions and miss something that obvious!
I see in the documentation a concern about being threadsafe? That kinda scares
me at this point. I've been fighting with the new dual core architecture for
months now with my programs only to find that I need to patch Windows XP SP2
because Micro$oft's stuff isn't designed to run the dual core machines and even
some of the faster single core machines! LOL
Thanks,
Rob
Bob Gonder wrote:
| Quote: | Robert G. Hoover wrote:
However, I'm using String("").sprintf("%.03f", MyFloat) to convert back to a
I end up with something like "5.200000384". I am using sprintf so I
can limit the number of significant digits displayed. Is there a way to limit my
sigdigs and utilize the global Regional Settings of Windows?
How about FloatToStrF() ?
|
|
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Fri May 18, 2007 2:07 pm Post subject: Re: Regional Settings and sprintf? |
|
|
"Robert G. Hoover" <not.a.real.address (AT) anywhere (DOT) sorry> wrote:
| Quote: | months now with my programs only to find that I need to patch Windows XP SP2
because Micro$oft's stuff isn't designed to run the dual core machines and even
some of the faster single core machines! LOL
|
Interestingly, I've never had a problem with Windows 2000 on a
multi-processor PC. Which bit of Windows was falling over?!
Alan Bellingham
--
ACCU Conference 2008: 2-5 April 2008 - Oxford (probably), UK |
|
| Back to top |
|
 |
Robert G. Hoover Guest
|
Posted: Mon May 21, 2007 4:30 pm Post subject: Re: Dual-core problems - Was: Regional Settings and sprintf |
|
|
Hi Alan,
I haven't been able to pinpoint the problem yet. I have a dual-core in
in my house that we're using to host data for internet viewing. It has
reset itself many times during operations such as downstreaming audio in
Firefox (internet radio), downstreaming video in Firefox (youtube,
quicktime), and running a screensaver. The screensavers are written (in
BCB2006) to not respond to mouse or keyboard input (except ALT-F4) so my
son isn't able to confuse windows. (He's two years old.)
Of the dual-cores at work, similar problems have occurred where they
reset themselves during operations of my robotics program, written in
BCB2006. So, it's either the OS or it's my programs. I'm trying to
eliminate 1 or the other now.
Our PC supplier (AOpen cubes) sent this link which makes me suspect the
OS. But as much as I love blaming Micro$oft for problems, it could very
well be (and likely is) something that I'm doing in my code.
http://support.microsoft.com/kb/896256/en-us
For the past week, I've been trying to duplicate the symptom and have
been unsuccessful on my home PC which does not run my robotics software.
At work, I have an unfamiliar "blue screen of death".
(http://tritekcorp.com/BlueScreen002.jpg)
So, I don't have much information as of yet. I'm still investigating.
But if anyone has has similar experiences, I'd sure like to hear about
it.... ;)
Many thanks,
Rob
Alan Bellingham wrote:
| Quote: | "Robert G. Hoover" <not.a.real.address (AT) anywhere (DOT) sorry> wrote:
months now with my programs only to find that I need to patch Windows XP SP2
because Micro$oft's stuff isn't designed to run the dual core machines and even
some of the faster single core machines! LOL
Interestingly, I've never had a problem with Windows 2000 on a
multi-processor PC. Which bit of Windows was falling over?!
Alan Bellingham |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|