From f9fdaf4ff30b80f060a3662cd683dcaf7ce74dce Mon Sep 17 00:00:00 2001 From: hackbard Date: Sat, 4 Jan 2003 14:42:25 +0000 Subject: [PATCH] added hex to interger calculator :) --- h2i-calc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 h2i-calc.c diff --git a/h2i-calc.c b/h2i-calc.c new file mode 100644 index 0000000..5042af6 --- /dev/null +++ b/h2i-calc.c @@ -0,0 +1,11 @@ +#include +#include + +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; +} + -- 2.39.2