User Tools

Site Tools


c:stdlib.h:strtoul

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:stdlib.h:strtoul [2013/01/22 22:02] (current)
Line 1: Line 1:
 +{{keywords>wiki library source code example reference}}
 +===== strtoul =====
 +<code c>
 +    #include <stdlib.h>
 +    unsigned long int strtoul(const char *str, char **endptr, int base);
 +</code>
 +strtoul Converting a string to an unsigned long integer\\
 +str: the string to be converted\\
 +endptr: address of a pointer variable that points to the last character read, so the character that is not owned by a number\\
 +base: base between 2 and 36\\
 +\\
 +Be found unprefixed numbers, these numbers in base 10 are accepted.\\
 +If the base '0 'is specified, the strings make a reference to the basis used\\
 +(leading "0x" for hexadecimal, "0" for octal, numbers).\\
 +
 +
 +===== strtoul c code example =====  
 +<code c>
 +/* 
 + * strtoul example code
 + * http://code-reference.com/c/stdlib.h/strtoul
 + */
 +#include <stdio.h>
 +#include <stdlib.h>
 +
 +int main ( void )
 +{
 +  char string[] ="20405";
 +  char *endptr;
 +  unsigned long int number;
 +
 +  number = strtoul(string, &endptr, 10);
 +  printf("string is %s\n",string);
 +  printf("unsigned long int is %li\n", number);
 +
 +  return 0;
 +}
 +</code>
 +
 +==== Output of strtoul example ====
 +
 +    user@host:~$ ./strtoul
 +    string is 20405
 +    unsigned long int is 20405
  
advertising
c/stdlib.h/strtoul.txt · Last modified: 2013/01/22 22:02 (external edit)

Impressum Datenschutz