在linux下使用strtol库函数需要包含哪个头文件,在window下是#include <stdlib.h>,急求解!
如题,在linux下使用strtol库函数需要包含哪个头文件,在window下是#include <stdlib.h>,急求解!!!
[解决办法]
<stdlib.h>
man一下就知道了。。
[解决办法]
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);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
strtoll():
XOPEN_SOURCE >= 600
[解决办法]
_BSD_SOURCE
[解决办法]
_SVID_SOURCE
[解决办法]
_ISOC99_SOURCE
[解决办法]
_POSIX_C_SOURCE >= 200112L;
or cc -std=c99
long l;吗?
char str[]="12345678";
int rc;
rc=sscanf(str,"%ld",&l);
if (1==rc) printf("%ld\n",l);//12345678