Bug in USG 5.2 stdio package.

gupta at asgb.UUCP gupta at asgb.UUCP
Fri Nov 2 01:59:23 AEST 1984


>  <stdio> usually requires an fseek() when switching between read <--> write
>  modes on a file opened in any of the "+" modes.  This is to insure that the
>  buffer pointers are set up properly.
>  
>  Jim Macropol
>  {ihnp4,trwrb,scgvaxd,vortex}!wlbr!jm

This is what the Programmer Reference Manual states:

-  FOPEN(3S)
-   		.
-   		.
-   		.
-
-          When a file is opened for update, both input and output may
-          be done on the resulting stream.  However, output may not be
-          directly followed by input without an intervening fseek or
-          rewind, and input may not be directly followed by output
-          without an intervening fseek, rewind,[1m or an input operation
-          which encounters end-of-file.[0m

Thus, after an input operation that encounters end-of-file, the printf should
work. Also, the printf doesn't work even if an fseek is added! Once you
start reading the file, you just cannot write it using the printf!!

Yogesh Gupta
{sdcrdcf, sdcsvax}!bmcg!asgb!gupta



More information about the Net.bugs.usg mailing list