examples/read_write: Fix hexadecimal value

Found by @kwikius in #74
pull/89/head
Olivier Martin 2019-03-05 13:26:44 +01:00 committed by Olivier Martin
parent 7ad64704cb
commit 846261120c
1 changed files with 3 additions and 3 deletions

View File

@ -53,10 +53,10 @@ int main(int argc, char *argv[]) {
} else if ((strcmp(argv[2], "write") == 0) && (argc == 5)) {
g_operation = WRITE;
if ((strlen(argv[4]) >= 2) && (argv[4][0] == '0') && (argv[4][0] == 'x')) {
value_data = strtol(argv[4], NULL, 0);
} else {
if ((strlen(argv[4]) >= 2) && (argv[4][0] == '0') && ((argv[4][1] == 'x') || (argv[4][1] == 'X'))) {
value_data = strtol(argv[4], NULL, 16);
} else {
value_data = strtol(argv[4], NULL, 0);
}
printf("Value to write: 0x%lx\n", value_data);
} else {