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/strtoul.html | 99 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 reference/C/FUNCTIONS/strtoul.html (limited to 'reference/C/FUNCTIONS/strtoul.html') diff --git a/reference/C/FUNCTIONS/strtoul.html b/reference/C/FUNCTIONS/strtoul.html new file mode 100644 index 0000000..c4f3ea3 --- /dev/null +++ b/reference/C/FUNCTIONS/strtoul.html @@ -0,0 +1,99 @@ +strtoul function + + + + + + +
+
+

strtoul function

+
+
+

+strtoul will convert a string to an unsigned 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 strtoul(const char *sptr, char **endptr, int base);
+
+Syntax:	   char string1[]="ff";			/* string to convert	*/
+	   int  base=16;			/* Base 16		*/
+           unsigned long int ans;		/* Result		*/
+
+           ans = strtoul(string, NULL, 16);
+
+ +
+

Notes

+The first argument must not contain a + or -.

+ +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 (actually the strtol example, but its near enough).

+


+

See also:

+

+ + +atoi String to integer conversion. +
+ +atof String to floating point conversion. +
+ +atol String to long integer conversion. +
+ +strtod +String to double conversion. +
+ +strtol String to long integer +conversion. + + +

+ +


+

+

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

+


+
Martin Leslie +

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