From: Jason Green Newsgroups: comp.os.msdos.djgpp Subject: Re: Weird output of printf() Date: Tue, 25 Jan 2000 22:05:40 +0000 Organization: Customer of Planet Online Lines: 16 Message-ID: <517s8s44q97grjfra88cqj2ur7pj0f6bjm@4ax.com> References: <388B549C DOT A2C038D AT ou DOT edu> <86jqbc$49u$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> NNTP-Posting-Host: modem-19.hyalgan.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news5.svr.pol.co.uk 948838315 19402 62.136.71.19 (25 Jan 2000 22:11:55 GMT) NNTP-Posting-Date: 25 Jan 2000 22:11:55 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Agent 1.7/32.534 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hans-Bernhard Broeker wrote: > > If it should work then I would expect "%#02x" to be the required > > Make that "%#04x", and it'll work. The '2' is too small, as it has to > count total output field width, including the "0x" added by that '#' > option in the format. Aha! Quite obvious really. :-) > Alternatively, you could > > printf("0x%02x\n", 0x0f); > > Same result, easier to understand.