home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.24 / text0086.txt < prev    next >
Encoding:
Text File  |  1991-09-03  |  1.1 KB  |  32 lines

  1. Submitted-by: eric@mks.com (Eric Gisin)
  2.  
  3. I have POSIX 1003.1-1988 and 1990 in front of me.
  4. Section 8.2.3 (Interaction with C stream functions) has some major changes.
  5.  
  6. Why was the requirement that fclose() set the file descriptor offset
  7. to the stream offset removed? Note the 1990 rational is wrong.
  8. This means applications have to do it themselves with
  9.     fflush(fp);
  10.     fseek(fp, 0L, SEEK_CUR);
  11.  
  12. I understand why fflush is no longer required to invalidate input buffers,
  13. but is a 1990 implementation required to leave input buffers untouched
  14. on non-seekable files? For example, can I write
  15.     fgetc(stdin);        /* first byte */
  16.     fflush(stdin);
  17.     [fork(), child does not use stdin but does exit()]
  18.     fgetc(stdin);        /* second byte */
  19. without concern that stdin may be a pipe?
  20. Or do I have to conditionalize the fflush with
  21.     if (!seekable(fileno(stdin))
  22. If so, how can I write seekable(), allowing for implementations
  23. that have non-seekable devices other that ttys and pipes?
  24.  
  25. Or, when using fork(), is it required to use _exit() and explicit fflush()s?
  26.  
  27.         Eric Gisin, eric@mks.com
  28.  
  29.  
  30. Volume-Number: Volume 24, Number 87
  31.  
  32.