Home C&C++函数库 c++ 语法 程序源码 Linux C库

wcstoull

函数  <cwchar>

unsigned long long int wcstoull (const wchar_t* str, wchar_t** endptr, int base);
将宽字符串类型转换为 unsigned long long integer类型

解析C宽字符串str,将其内容解释为指定base(进制)的整数, 并以 unsigned long long integer形式返回其值。
如果endptr不是空指针,该函数还将整数后面的第一个字符设置为endptr指向的值。

这是与strtoull (<cstdlib>)等效的宽字符版本,以同样的方式解释str。

☲  参数



str
以整数表示开头的宽字符串。

endptr
引用类型为wchar_t*的已分配对象,其值由函数设置为整数后的str中的下一个字符。

该参数也可以是空指针,在这种情况下,函数不会使用它。

☉  返回值



如果成功,该函数将转换后的整数作为unsigned long long int类型的值返回。
如果不能执行有效的转换,则返回零值 (0ULL)。
如果读的值超出了unsigned long long int的可表示值范围, 则函数返回ULLONG_MAX(在<climits>中定义), errno设置为ERANGE。

☣  示例



/* wcstoull example */
#include <wchar.h>

int main ()
{
  wchar_t wsNumbers[] = L"250068492 7b06af00 1100011011110101010001100000 0x6fffff";
  wchar_t * pEnd;
  unsigned long long int ulli1, ulli2, ulli3, ulli4;
  ulli1 = wcstoull (wsNumbers,&pEnd,10);
  ulli2 = wcstoull (pEnd,&pEnd,16);
  ulli3 = wcstoull (pEnd,&pEnd,2);
  ulli4 = wcstoull (pEnd,NULL,0);
  wprintf (L"The decimal equivalents are: %llu, %llu, %llu and %llu.\n", ulli1, ulli2, ulli3, ulli4);
  return 0;
}

输出:
The decimal equivalents are: 250068492, 2064035584, 208622688 and 7340031.


🍄  另请参阅



strtoull 将字符串转换为unsigned long long integer(function )
wcstoul 将宽字符串转换为 unsigned long integer (function )
wcstod 将宽字符串转换为double (function )
wcstoll 将宽字符串转换为 long long integer (function )

联系我们 免责声明 关于CandCplus 网站地图