Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages
Started by Robert G. Hoover
Wed, 16 May 2007 17:22
Regional Settings and sprintf?
Author: Robert G. Hoover
Date: Wed, 16 May 2007 17:22
Date: Wed, 16 May 2007 17:22
17 lines
1748 bytes
1748 bytes
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
Re: Regional Settings and sprintf?
Author: Bob Gonder
Date: Wed, 16 May 2007 18:34
Date: Wed, 16 May 2007 18:34
8 lines
1267 bytes
1267 bytes
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() ?
Re: Regional Settings and sprintf?
Author: Robert G. Hoover
Date: Thu, 17 May 2007 21:08
Date: Thu, 17 May 2007 21:08
28 lines
1994 bytes
1994 bytes
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:
> 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() ?
>
>
Re: Regional Settings and sprintf?
Author: Alan Bellingham
Date: Fri, 18 May 2007 09:07
Date: Fri, 18 May 2007 09:07
12 lines
1504 bytes
1504 bytes
"Robert G. Hoover" <not.a.real.address@anywhere.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 -- ACCU Conference 2008: 2-5 April 2008 - Oxford (probably), UK
Re: Dual-core problems - Was: Regional Settings and sprintf?
Author: Robert G. Hoover
Date: Mon, 21 May 2007 11:30
Date: Mon, 21 May 2007 11:30
47 lines
3063 bytes
3063 bytes
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: > "Robert G. Hoover" <not.a.real.address@anywhere.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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads