Newsgroups: comp.lang.ada,comp.lang.apl,comp.lang.basic.misc,comp.lang.basic.visual.misc,comp.lang.c,comp.lang.c++,comp.lang.clos,comp.lang.eiffel,comp.lang.forth,comp.lang.fortran,comp.lang.lisp,comp.lang.misc,comp.lang.modula2,comp.lang.oberson,comp.lang.pascal,comp.lang.prolog,comp.lang.smalltalk,comp.lang.objective-c,comp.lang.functional
Path: cantaloupe.srv.cs.cmu.edu!europa.chnt.gtegsc.com!gatech!howland.reston.ans.net!tank.news.pipex.net!pipex!oleane!jussieu.fr!univ-lyon1.fr!swidir.switch.ch!scsing.switch.ch!news.belwue.de!news.uni-mannheim.de!fht-mannheim!roxi.rz.fht-mannheim.de!duz
From: duz@roxi.rz.fht-mannheim.de (Dirk Zoller)
Subject: Re: Please help with research
References: <19950814T190825Z@naggum.no> <40qb09$km7@nic.umass.edu> <MARCOXA.95Aug17084849@mosaic.nyu.edu> <411964$fvk@celebrian.otago.ac.nz>
Sender: news@roxi.rz.fht-mannheim.de (NEWS - system account)
Organization: Fachhochschule fuer Technik, Mannheim (FRG)
Date: Fri, 18 Aug 95 07:16:01 CET
X-Newsreader: TIN [version 1.2 PL2]
Message-ID: <1995Aug18.071601.22285@roxi.rz.fht-mannheim.de>
Lines: 28
Xref: glinda.oz.cs.cmu.edu comp.lang.ada:34055 comp.lang.apl:7217 comp.lang.basic.misc:8234 comp.lang.basic.visual.misc:31630 comp.lang.c:151870 comp.lang.c++:144605 comp.lang.clos:3401 comp.lang.eiffel:10444 comp.lang.forth:23588 comp.lang.fortran:31340 comp.lang.lisp:18827 comp.lang.misc:22747 comp.lang.modula2:12381 comp.lang.prolog:13681 comp.lang.smalltalk:27352 comp.lang.objective-c:4372 comp.lang.functional:6216

Nick Mein (nmein@bifrost.otago.ac.nz) wrote:
: /*
:  * puthex: Writes hexadecimal representation of character c
:  *         to stdout. It returns the character written (cf. the
:  *         standard library function putchar).
:  */
: int puthex(unsigned char c)
: {
:   static char hexdigit[] = {'0', '1', '2', '3', '4', '5', '6', '7',
: 			    '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};

:   putchar(hexdigit[c / 16]);
:   putchar(hexdigit[c % 16]);

:   return c;
: }

You could of course simplify that to

	printf("%02x", c)

or "%02X" if you prefer caps letters. printf() is one of that nice
things in C I'll always miss everywhere else.

Dirk

--
duz@roxi.rz.fht-mannheim.de <Dirk Zoller>
