We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ad6470 commit 8462611Copy full SHA for 8462611
examples/read_write/read_write.c
@@ -53,10 +53,10 @@ int main(int argc, char *argv[]) {
53
} else if ((strcmp(argv[2], "write") == 0) && (argc == 5)) {
54
g_operation = WRITE;
55
56
- if ((strlen(argv[4]) >= 2) && (argv[4][0] == '0') && (argv[4][0] == 'x')) {
57
- value_data = strtol(argv[4], NULL, 0);
58
- } else {
+ if ((strlen(argv[4]) >= 2) && (argv[4][0] == '0') && ((argv[4][1] == 'x') || (argv[4][1] == 'X'))) {
59
value_data = strtol(argv[4], NULL, 16);
+ } else {
+ value_data = strtol(argv[4], NULL, 0);
60
}
61
printf("Value to write: 0x%lx\n", value_data);
62
} else {
0 commit comments