Subject: lib/6072: stdio documentation bug
To: None <>
From: Andreas Gustafsson <>
List: netbsd-bugs
Date: 08/30/1998 20:39:46
>Number:         6072
>Category:       lib
>Synopsis:       stdio documentation bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 30 16:20:09 1998
>Originator:     Andreas Gustafsson
Araneus Information Systems Oy
>Release:        1.3.2

System: NetBSD 1.3.2 NetBSD 1.3.2 (GUAVA) #2: Wed Aug 5 09:44:51 EEST 1998 i386


The fopen(3) man page states:

     Reads and writes may be intermixed on read/write streams in any order,
     and do not require an intermediate seek as in previous versions of stdio.

This claim is incorrect.


Run the following test program and examine the contents of the
resulting file.

  #include <err.h>
  #include <stdio.h>

  int main(int argc, char **argv)
      FILE *fp;
      int i;
      /* Make a file containing 16384 spaces */
      fp = fopen("test.fil", "w");
      if (!fp) err(1, "fopen");
      for (i = 0; i < 16384; i++)
	  putc(' ', fp);

	Reopen the file, read the first two characters and then 
	attempt to replace the third one with an "X".  
      fp = fopen("test.fil", "r+");
      if (!fp) err(1, "fopen");
      putc('X', fp);

  /* Now examine the file and notice the third character is not an "X". */


Remove the paragraph containing the quoted text from the man page.