C atoi () for wide characters on linux?

Is there an c atoi () equivalent for wide characters in Linux? I can find something for MS (wtoi), but I can find something in the standard Linux lib.

+4
source share
2 answers

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

+6
source

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

The reason is that Linux uses utf-8 as standard encoding. char const* strings are considered utf-8 glibc strings. Ascii characters and utf-8 digits have the same byte representation, so atoi () works with both ascii and utf-8 strings.

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

+6
source

Source: https://habr.com/ru/post/891013/


All Articles