LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Locale-specific decimal separator in Fmt?

Solved!
Go to solution

Is there a way to get floating-point numbers to use the locale-specific decimal separator in the Fmt() function?

 

It appears that SetSystemAttribute will only change the separator for UI elements, as described in this thread.  Calling setlocale(LC_ALL, "") doesn't seem to be working either. 

 

Is this possible?

0 Kudos
Message 1 of 4
(3,734 Views)

Ron,

 

I dont think there is a valid locale-specific-separator you can send the fmt function, but a very simple workaround would be to convert what youre looking at to a string, and swap the period for a comma if they are in the proper locale. The setlocale can be used to read locale settings in windows I believe, if you need to check for those. 

 

Regards,

 

Kyle Mozdzyn

Applications Engineering

National Instruments

Regards,

Kyle M.
Applications Engineering
National Instruments
Message 2 of 4
(3,720 Views)
Solution
Accepted by topic author ronbrown

Thanks for the reply.  I ended up just doing a search and replace and swapping every instance of Fmt() with sprintf_s(), which DOES pay attention to setlocale().

0 Kudos
Message 3 of 4
(3,713 Views)

Ron,

 

Thats great to hear you got it working, and thanks for posting your solution. Learn something new every day!

 

Regards,

 

Kyle Mozdzyn

Applications Engineering

National Instruments

Regards,

Kyle M.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 4
(3,698 Views)