From 7e0f021a9aec35fd8e6725e87e3313b101d26f5e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 27 Jan 2008 11:37:44 +0100 Subject: Initial import (2.0.2-6) --- reference/C/FUNCTIONS/strtol.html | 90 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 reference/C/FUNCTIONS/strtol.html (limited to 'reference/C/FUNCTIONS/strtol.html') diff --git a/reference/C/FUNCTIONS/strtol.html b/reference/C/FUNCTIONS/strtol.html new file mode 100644 index 0000000..1a676fc --- /dev/null +++ b/reference/C/FUNCTIONS/strtol.html @@ -0,0 +1,90 @@ +strtol function + + + + + + +
+
+

strtol function

+
+
+

+strtol will convert a string to a long integer. An important feature +of this function is the ability to accept data in various number bases +and convert to decimal. If +you are just working with decimal numbers, +atoi is probably an easer function to use. +

+


+
+
+Library:   stdlib.h
+
+Prototype: long int strtol(const char *sptr, char **endptr, int base);
+
+Syntax:	   char     String[]="ff";		/* string to convert	*/
+	   int      Base=16;			/* Base 16		*/
+           long int Ans;			/* Result		*/
+
+           Ans = strtol(String, NULL, Base);
+
+ +
+

Notes

+The second argument (char **endptr) seems to be a waste of space! If +it is set to NULL, STRTOL +seems to work its way down the string until it finds an invalid character +and then stops. All valid chars read are then converted if the string +starts with an invalid character the function returns ZERO (0). +

+The Third argument (base) can have a value of 0 or 2-32. +

+
+

Examples:

+ + Example program. +

+


+

See also:

+

+

atoi String to integer conversion. +
atof String to floating point conversion. +
atol String to long integer conversion. +
strtod String to double conversion. +
strtoul String to unsigned long integer +conversion. +
Conversion table. +

+ + +

+ +


+

+

+ + + + +
+ Top + + Master Index + + Keywords + + Functions +
+
+

+


+
Martin Leslie +

+ + -- cgit v1.2.3-54-g00ecf