DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
[C] - Read Hex Argument From Console Into Integer
// This code Reads a hexadecimal argument from the commandline and puts it into a integer
// INPUT: ./prog ff aa
// OUTPUT: hex_values: ff and aa
int main (int argc, char *argv[]) {
int hex_values[2];
hex_values[0] = strtol(argv[1], NULL, 16);
hex_values[1] = strtol(argv[2], NULL, 16);
printf("hex_values: %x and %x", hex_values[0], hex_values[1]);
}





