Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!rochester!udel!burdvax!bpa!cbmvax!snark!eric From: eric@snark.UUCP (Eric S. Raymond) Newsgroups: comp.lang.c Subject: Re: Printing binary Message-ID: <247@snark.UUCP> Date: Sun, 25-Oct-87 10:30:22 EST Article-I.D.: snark.247 Posted: Sun Oct 25 10:30:22 1987 Date-Received: Thu, 29-Oct-87 20:39:20 EST References: <35@ateng.UUCP> <3194@sol.ARPA> <2783@xanth.UUCP> <235@snark.UUCP> <2072@watcgl.waterloo.edu> Sender: eric@snark.UUCP (Eric S. Raymond) Organization: Benevolent Space Xist Retirement Home Lines: 11 Summary: But you can't do sprintf with it In article <1646@spar.SPAR.SLB.COM>, hunt@spar.SPAR.SLB.COM (Neil Hunt) writes: > This is crying out for recursion: [followed by a print_binary implementation] Now that's more elegant than my internal-to-hex-nybbles-to binary hack (which I posted mostly for its giggle value). It also avoids the flaw of the second proposal (which is nonportable, requiring this ugly #define in source for the machine's word length). But your trick can't be generalized to do the sprintf analogue. GONG! :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-) :-)