Read hexadecimal argument from command line
This piece of code will read a hex argument such as: ff or ab from your command line and stores it as a integer
Copy this code and paste it in your HTML
/*
IN: program ff aa
OUT: Values: ff, aa
*/
int main (int argc, char *argv[]) {
unsigned int values[2];
values
[0] = strtol(argv
[1], NULL
, 16); values
[1] = strtol(argv
[2], NULL
, 16);
printf("Values: %x, %x", values
[0], values
[1]); }
Report this snippet
Comments
Subscribe to comments