home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / amiga / programm / 11657 < prev    next >
Encoding:
Text File  |  1992-07-26  |  1.9 KB  |  45 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!darwin.sura.net!haven.umd.edu!wam.umd.edu!walrus
  3. From: walrus@wam.umd.edu (Udo K Schuermann)
  4. Subject: SAS/C 5.10b fopen(...,"w+") bug?
  5. Message-ID: <1992Jul26.190553.26493@wam.umd.edu>
  6. Summary: "w+" doesn't preserve file as documented
  7. Sender: usenet@wam.umd.edu (USENET News system)
  8. Nntp-Posting-Host: wam.umd.edu
  9. Organization: University of Maryland, College Park
  10. Distribution: comp
  11. Date: Sun, 26 Jul 1992 19:05:53 GMT
  12. Lines: 31
  13.  
  14. Hi, it's me again.  Seems all I ever have is problems :-(
  15.  
  16. I use SAS/C 5.10b under KS2.04 and am opening a file with a statement such
  17. as the following:
  18.  
  19.     struct FILE *myFile;
  20.     myFile = fopen("t:test","w+");
  21.  
  22. This clears out the file if it contains any information instead of preserving
  23. existing information!  The documentation on page L72-L73 describes the use of
  24. the "w+" mode as 1) creating the file if it doesn't exist yet, 2) preserving
  25. existing contents (WHICH IT DOESN'T!), 3) providing r/w access to the file.
  26.  
  27. The function behaves exactly as if I had not specified the "+" symbol in the
  28. mode.  I have though.  I have I have I have!  :-/
  29.  
  30. Is this a known problem and does this have a workaround?  I've traced
  31. through the assembly of the fopen() call until I got thoroughly lost; it
  32. seemed, though that the fopen() function called the level 1 open()
  33. function.  So if this problem propagates to the level 1 open() then what
  34. can I do?
  35.  
  36. I've now spent too many hours on it, even slept over it, and the problem
  37. persists.  Resorting to a sequence of "r" and "w" calls is not really an
  38. acceptable solution for a variety of reasons.
  39.  
  40. Anyone?  Please?!?
  41.  
  42.  ._.  Udo Schuermann     "If I went around calling myself emperor just because
  43.  ( )  walrus@wam.umd.edu  some moistened bint lobbed a scimitar at me, they'd
  44.  Seeking virtual memory   put me away!"         -- Monty Python's "Holy Grail"
  45.