Function name: Atol functions: Convert string to grow integer usage: Long atol (const char *nptr);Introduction Edit Related functions: Atof,atoi,strtod,strtol,strtoul header file: #include <stdlib.h> define function: Long atol (const char *nptr); function Description: Atol () The parameter nptr string is scanned, skipping the previous empty characters (meaning that the left space of the string is ignored), until a number or sign is encountered to start the conversion, and then the non-numeric or string ends (' \ ") ends the conversion and returns the result. Return value: Returns the number of long integers after the conversion. If the passed-in string is empty, or if the string contains a non-Arabic sequence, the function returns the default value of 0. Additional instructions: ATOL () with the use of Strtol (nptr, (char**) null,10);2 Procedure Example 1
#include <stdlib.h>
#include <stdio.h>
int
main(
void
)
{
long
l;
char
*str =
"98765432"
;
l =
atol
(str);
/* 原来为l = atol(str); */
printf
(
"string = %s integer = %ld\n"
, str, l);
return
(0);
}3 Procedure Example 2
/* Convert string A and string B to numbers and add */
#include<stdlib.h>
main()
{
char
a[]=”1000000000”;
char
b[]=” 234567890”;
long
c;
c=
atol
(a)+
atol
(b);
printf
(“c=%d\n”,c);
}Perform c=1234567890------------------------------------------------------------------------------------------------ -----------_variant_t vt_decimal ext. int
_variant_t Vtsumcount = _bstr_t ("0");
Vtsumcount.changetype (Vt_decimal);
Char csumvalue[16]={0};
strcpy (Csumvalue, (LPCSTR) _bstr_t (Vtsumcount));
int sumcount;
Sumcount = Atoi (Csumvalue);
C + + Atol