/* * hex2dez.c * * Copyright (c) 1997-2004 DF7BE * * $Id$ * * Logbuchprogramm DF7BE * Amateur-Radio log by DF7BE * Utility to convert hex number to decimal * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the license, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA ( or visit * their web site at http://www.gnu.org/ ). * * * Modification documentation * * +------------+-------------------------+----------------------------------+ * + Date ! Name and Call ! Modification ! * +------------+-------------------------+----------------------------------+ * ! 10.03.2004 ! W.Brunken DF7BE ! first creation ! * +------------+-------------------------+----------------------------------+ * * Compiling: * * gcc hex2dez.c -o hex2dez.exe (DJGPP) * gcc hex2dez.c -o hex2dez (UNIX,LINUX) * cc hex2dez.c -o hex2dez (UNIX) * MICROSOFT QUICK C 2.5 : use Make Menu * set at Options model to "small" */ /* Dieses banale Programm liest einen Hexadezimalwert von der Standardeingabe und macht daraus einen Dezimalwert. Beispiel: hostid | hex2dez (auf Solaris soll fuer eine MySQL-Datenbank die hex angelieferte Host-ID in einen Dezimalen Wert fuer die Datenbank-ID umgewandelt werden) */ #include int main() { unsigned long z; z = 0L; scanf("%lx", &z); printf("%lu\n", z); return 0; } /* Fuer UNIX genuegt: scanf("%x", &z); printf("%u\n", z); Fuer DOS (QC) scanf("%x", &z); printf("%u\n", z); */