免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 12661 | 回复: 10
打印 上一主题 下一主题

内核中的strtol函数在哪个头文件中? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-01-02 11:14 |只看该作者 |倒序浏览
如题,如果没有这个函数,有类似功能函数吗?

论坛徽章:
0
2 [报告]
发表于 2012-01-02 12:45 |只看该作者
求解答呀~求解答

论坛徽章:
0
3 [报告]
发表于 2012-01-02 14:39 |只看该作者
楼主要善于利用 man,在shell下 man strtol就知道一切了

STRTOL(3)                  Linux Programmer’s Manual                 STRTOL(3)

NAME
       strtol, strtoll, strtoq - convert a string to a long integer

SYNOPSIS
       #include <stdlib.h>

       long int
       strtol(const char *nptr, char **endptr, int base);

       long long int
       strtoll(const char *nptr, char **endptr, int base);

论坛徽章:
0
4 [报告]
发表于 2012-01-02 15:11 |只看该作者
大哥,内核中不能用stdlib.h的。。。我问的是内核中有没有回复 3# yph007595


   

论坛徽章:
0
5 [报告]
发表于 2012-01-02 19:06 |只看该作者
lib/kstrtox.c
上里面看看

论坛徽章:
36
IT运维版块每日发帖之星
日期:2016-04-10 06:20:00IT运维版块每日发帖之星
日期:2016-04-16 06:20:0015-16赛季CBA联赛之广东
日期:2016-04-16 19:59:32IT运维版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-19 06:20:00每日论坛发贴之星
日期:2016-04-19 06:20:00IT运维版块每日发帖之星
日期:2016-04-25 06:20:00IT运维版块每日发帖之星
日期:2016-05-06 06:20:00IT运维版块每日发帖之星
日期:2016-05-08 06:20:00IT运维版块每日发帖之星
日期:2016-05-13 06:20:00IT运维版块每日发帖之星
日期:2016-05-28 06:20:00每日论坛发贴之星
日期:2016-05-28 06:20:00
6 [报告]
发表于 2012-01-02 19:29 |只看该作者
回复 1# tianqiang2516

这个估计需要自己写一个。

   

论坛徽章:
0
7 [报告]
发表于 2012-01-02 20:25 |只看该作者
Godbach 发表于 2012-01-02 19:29
回复 1# tianqiang2516

这个估计需要自己写一个。


内核里有实现了的。

论坛徽章:
22
丑牛
日期:2014-08-15 14:32:0015-16赛季CBA联赛之同曦
日期:2017-12-14 15:28:14黑曼巴
日期:2017-08-10 08:14:342017金鸡报晓
日期:2017-02-08 10:39:42黑曼巴
日期:2016-11-15 15:48:38CU十四周年纪念徽章
日期:2016-11-09 13:19:1015-16赛季CBA联赛之同曦
日期:2016-04-08 18:00:03平安夜徽章
日期:2015-12-26 00:06:30程序设计版块每日发帖之星
日期:2015-12-03 06:20:002015七夕节徽章
日期:2015-08-21 11:06:17IT运维版块每日发帖之星
日期:2015-08-09 06:20:002015亚冠之吉达阿赫利
日期:2015-07-03 08:39:42
8 [报告]
发表于 2012-01-02 20:29 |只看该作者
本帖最后由 amarant 于 2012-01-02 20:31 编辑

有一个simple_strtol
  1. Cscope tag: .*strtol.*
  2.    #   line  filename / context / line
  3.    1    218  include/linux/kernel.h <<.*strtol.*>>
  4.              static inline int __must_check k...s, unsigned int base, long *res)
  5.    2    297  include/linux/kernel.h <<.*strtol.*>>
  6.              #define strict_strtol kstrtol
  7.    3    299  include/linux/kernel.h <<.*strtol.*>>
  8.              #define strict_strtoll kstrtoll
  9.    4    107  lib/kstrtox.c <<.*strtol.*>>
  10.              int kstrtoll(const char *s, unsigned int base, long long *res)
  11.    5    148  lib/kstrtox.c <<.*strtol.*>>
  12.              int _kstrtol(const char *s, unsigned int base, long *res)
  13.    6    237  lib/test-kstrtox.c <<.*strtol.*>>
  14.              static void __init test_kstrtoll_ok(void )
  15.    7    270  lib/test-kstrtox.c <<.*strtol.*>>
  16.              static void __init test_kstrtoll_fail(void )
  17.    8     77  lib/vsprintf.c <<.*strtol.*>>
  18.              long simple_strtol(const char *cp, char **endp, unsigned int base)
  19.    9     92  lib/vsprintf.c <<.*strtol.*>>
  20.              long long simple_strtoll(const c... char **endp, unsigned int base)
  21. Type number and <Enter> (empty cancels):
复制代码

论坛徽章:
0
9 [报告]
发表于 2012-01-02 21:36 |只看该作者
恩,我用的就是这个,谢谢了。回复 8# amarant


   

论坛徽章:
0
10 [报告]
发表于 2012-01-03 16:18 |只看该作者
simple_strtol
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP