home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!haven.umd.edu!wam.umd.edu!walrus
- From: walrus@wam.umd.edu (Udo K Schuermann)
- Subject: Re: SAS/C 5.10b fopen(...,"w+") bug?
- Message-ID: <1992Jul27.012709.11726@wam.umd.edu>
- Summary: workaround for library bug in fopen() with SAS/C 5.10b
- Sender: usenet@wam.umd.edu (USENET News system)
- Nntp-Posting-Host: wam.umd.edu
- Organization: University of Maryland, College Park
- References: <1992Jul26.190553.26493@wam.umd.edu>
- Distribution: comp
- Date: Mon, 27 Jul 1992 01:27:09 GMT
- Lines: 27
-
- In article <1992Jul26.190553.26493@wam.umd.edu> I wrote:
- > struct FILE *myFile;
- > myFile = fopen("t:test","w+");
- >
- >This clears out the file if it contains any information instead of preserving
- >existing information! The documentation on page L72-L73 describes the use of
- >the "w+" mode as 1) creating the file if it doesn't exist yet, 2) preserving
- >existing contents (WHICH IT DOESN'T!), 3) providing r/w access to the file.
-
- Well, this went quickly! Looks like it IS a bug. The following code is a
- workaround which seems to provide equivalent file access:
-
- FILE *myFile;
-
- if( (myFile = fopen("test.file","a+") ) {
- fclose( myFile );
- myFile = fopen("test.file","r+");
- }
-
- Thanks to Trent Gray-Donald <tagraydo@undergrad.math.waterloo.edu> for
- responding so quickly and confirming the problem was not my own stupidity.
-
- I seem to have a knack for hunting down O/S and compiler/library bugs ... :-/
-
- ._. Udo Schuermann "If I went around calling myself emperor just because
- ( ) walrus@wam.umd.edu some moistened bint lobbed a scimitar at me, they'd
- Seeking virtual memory put me away!" -- Monty Python's "Holy Grail"
-