C Tutorial/stdlib.h/strtoul — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Текущая версия на 10:32, 25 мая 2010

strtoul

Item Value Header

  1. include <stdlib.h>

Declaration unsigned long int strtoul(const char *start, char **end, int radix); Function converts the string into an unsigned long int according to the base of the number.

  1. If radix is zero, the base is determined by the rules that govern constant specification.
  2. If the radix is specified, it must be in the range 2 through 36.

Reads unsigned base 16 (hexadecimal) numbers from standard input and returns their unsigned long equivalent:


#include <stdlib.h>
int main(void){
    char *start, *end;
    char a[100];
    end = a;
    *start= "12341234";
    printf("%d", strtoul(start, &end, 8));
}