如何在Linux上获得等效的printf_l? [英] How to get equivalent of printf_l on Linux?

查看:72
本文介绍了如何在Linux上获得等效的printf_l?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此功能在OS X上存在,并且允许您将自定义本地传递给该功能. setlocale不是线程安全的,因此将语言环境作为参数进行传递.

This function exists on OS X and allows you to pass custom local to the function. setlocale is not thread-safe, and passing locale as parameter is.

如果没有等效项,则可以采用任何与语言环境无关的方法printf或仅用于双精度(%g)的printf.

If there is no equivalent, any way of locale-independent printf, or printf just for doubles (%g) will be ok.

推荐答案

There are locale-independent double to string convertion routines at http://www.netlib.org/fp/. String to double conversion is available too. The API is not very nice, but the code works.

这篇关于如何在Linux上获得等效的printf_l?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆