'programming'에 해당되는 글 387건

  1. 2016.04.27 unsigned long long int strtoull

반응형



http://www.cplusplus.com/reference/cstdlib/strtoull/




unsigned long long int strtoull (const char* str, char** endptr, int base);





/* strtoull example */
#include <stdio.h>      /* printf, NULL */
#include <stdlib.h>     /* strtoull */

int main ()
{
  char szNumbers[] = "250068492 7b06af00 1100011011110101010001100000 0x6fffff";
  char * pEnd;
  unsigned long long int ulli1, ulli2, ulli3, ulli4;
  ulli1 = strtoull (szNumbers, &pEnd, 10);
  ulli2 = strtoull (pEnd, &pEnd, 16);
  ulli3 = strtoull (pEnd, &pEnd, 2);
  ulli4 = strtoull (pEnd, NULL, 0);
  printf ("The decimal equivalents are: %llu, %llu, %llu and %llu.\n", ulli1, ulli2, ulli3, ulli4);
  return 0;
}

<결과>
The decimal equivalents are: 250068492, 2064035584, 208622688 and 7340031.


 

 

 

strtoul  - Convert string to unsigned long integer (function )
atol -  Convert string to long integer (function )
strtoll - Convert string to long long integer (function )
strtod - Convert string to double (function )

 

반응형
Posted by 공간사랑
,