简体   繁体   English

将u_int32_t转换为char **

[英]converting u_int32_t to char **

I am working with functions (c language )and there is a variable declared as u_int32_t value; 我正在使用函数(C语言),并且有一个声明为u_int32_t value;的变量u_int32_t value;

and I have to pass it to a function which takes argument of type (char **) 我必须将其传递给采用类型(char **)参数的函数

I have tried using value[0] etc but it doesnot work. 我试过使用value [0]等,但是它不起作用。

How to go ahead with typecasting? 如何进行类型转换? or 要么

Is there any workaround for it? 有什么解决方法吗?

A (char **) type almost certainly means a pointer (*) to either one or else an array of C-string (which is a pointer to its first char, or a char * ). (char **)类型几乎可以肯定是指一个(*)指向一个或另一个C字符串数组的指针(它是指向其第一个char或char *的指针)。

The most likely solution is hence to generate a C-string from your integer value, and pass a reference to it to the function you want to call with a char ** argument. 因此,最可能的解决方案是从整数值生成C字符串,并将对它的引用传递给要使用char **参数调用的函数。 Whether this solves your problem depends on the details of this function and what you are trying to achieve. 这能否解决您的问题取决于此功能的详细信息以及您要实现的目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM