projects
/
my-code
/
beginners.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
26bedf2
)
added hex to interger calculator :)
author
hackbard
<hackbard>
Sat, 4 Jan 2003 14:42:25 +0000
(14:42 +0000)
committer
hackbard
<hackbard>
Sat, 4 Jan 2003 14:42:25 +0000
(14:42 +0000)
h2i-calc.c
[new file with mode: 0644]
patch
|
blob
diff --git a/h2i-calc.c
b/h2i-calc.c
new file mode 100644
(file)
index 0000000..
5042af6
--- /dev/null
+++ b/
h2i-calc.c
@@ -0,0
+1,11
@@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc,char *argv[]) {
+ char hex_char[10];
+ sprintf(hex_char,"0x%s",argv[1]);
+ printf("%s (dec) -> %x (hex)\n",argv[1],atoi(argv[1]));
+ printf("%s (hex) -> %ld (dec)\n",argv[1],strtol(hex_char,NULL,0));
+ return 1;
+}
+