Printing integers with thousands separators in Windows using C

蓝咒 提交于 2019-12-01 13:45:58

The Win32 API does provide a function that will format a number with thousands grouping (or whatever grouping is appropriate for the specified locale): GetNumberFormat() (http://msdn.microsoft.com/en-us/library/dd318110.aspx).

Unfortunately, it's a pretty painful API to use - not nearly as simple as the apostrophe format specifier in SUS (on the other hand, you get a lot of flexibility in exchange for the complexity)

Use GetNumberFormatEx (for Windows Vista and later). The option LOCALE_NAME_USER_DEFAULT uses the preferences set in the Control Panel under regional and language options, including a thousands seperator.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!