Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!decvax!ucbvax!levy@ucbvax.Berkeley.EDU@ttrdc.UUCP
From: levy@ucbvax.Berkeley.EDU@ttrdc.UUCP
Newsgroups: mod.computers.vax
Subject: printf() bug in VMS C 2.0?
Message-ID: <8612041854.AA23322@ucbvax.Berkeley.EDU>
Date: Thu, 4-Dec-86 13:54:16 EST
Article-I.D.: ucbvax.8612041854.AA23322
Posted: Thu Dec  4 13:54:16 1986
Date-Received: Sat, 6-Dec-86 20:51:21 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 32
Approved: info-vax@sri-kl.arpa

I have found what appears to be a bug in printf under VMS C 2.0 (running on
VMS 4.3).

main()
{
	
	printf("X%2.2dX\n",2);
}

will produce the output line
X 2X
 ^
 |
 +-[this is a blank]

when compiled in the aforementioned VMS C.

Under all versions of UNIX C compilers that I have tried, I get what I want:
X02X

Is this a "known bug"?  Is there some workaround which doesn't require using
different format strings depending on the value of the number being printed?
(I want to print numbers in the range 0-99 and have them come out as precisely
two digits.  And I want to do it portably in C.)  THANKS....
--
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
	   go for it!  			allegra,ulysses,vax135}!ttrdc!levy