Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!watmath!clyde!cbatt!ucbvax!BU-CS.BU.EDU!bzs
From: bzs@BU-CS.BU.EDU.UUCP
Newsgroups: mod.computers.vax
Subject: printf() bug in VMS C 2.0?
Message-ID: <8612070306.AA09853@bu-cs.bu.edu>
Date: Sat, 6-Dec-86 22:06:07 EST
Article-I.D.: bu-cs.8612070306.AA09853
Posted: Sat Dec  6 22:06:07 1986
Date-Received: Sun, 14-Dec-86 00:47:49 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 31
Approved: info-vax@sri-kl.arpa


From: levy@ucbvax.Berkeley.EDU@ttrdc.UUCP
>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

Use:

	printf("X%02.2dX\n",2);
                  ^

(this works on UNIX also and is "more correct", I'm not sure that what
you were relying upon didn't work by accident, see the printf man page.)

		-Barry Shein, Boston University