Skip to content

Instantly share code, notes, and snippets.

@codingfoo
Created December 30, 2013 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codingfoo/8183596 to your computer and use it in GitHub Desktop.
Save codingfoo/8183596 to your computer and use it in GitHub Desktop.
Example of strtol function
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int val;
char str[20];
strcpy(str, "0x00010");
val = strtol(str, (char **) NULL, 16);
printf("String value = %s, Int value = %d\n", str, val);
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment