如何将char *转换为int? [英] How do I convert a char* to an int?
本文介绍了如何将char *转换为int?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将char *转换为整数。例如:
I need to convert a char* to an integer. For example:
data.SetBytFldPos(*attribute->value());
属性类中的值为char *。 SetBytFldPos接受一个整数。
The value in the attribute class is a char*. 'SetBytFldPos" takes an int.
推荐答案
很多方法,最简单的是使用 strtol()函数。
Lots of ways. Simplest is to use the strtol() function.
这篇关于如何将char *转换为int?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文