c atoi() for wide chars on linux?

杀马特。学长 韩版系。学妹 提交于 2019-12-05 10:17:39

You can use wcstol to convert from wide strings to integer values.

It is unusual for a Linux program to use wchar_t type.

The reason being that Linux uses utf-8 as the standard encoding. char const* strings are assumed to be utf-8 strings by glibc. Ascii digits and utf-8 digits have the same byte representation, so that atoi() works both on ascii and utf-8 strings.

Having said that, look in #include <wchar.t>, it provides wcstol().

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