home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / msdos / programm / 9103 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.2 KB  |  32 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!usenet.ucs.indiana.edu!bronze.ucs.indiana.edu!yawei
  3. From: yawei@bronze.ucs.indiana.edu (~{QG9p~})
  4. Subject: Re: fclose() messes up heap
  5. Message-ID: <Bu66FI.Drp@usenet.ucs.indiana.edu>
  6. Sender: news@usenet.ucs.indiana.edu (USENET News System)
  7. Nntp-Posting-Host: bronze.ucs.indiana.edu
  8. Organization: Indiana University
  9. References: <1992Sep3.210532.22036@tc.cornell.edu>
  10. Date: Sun, 6 Sep 1992 18:38:05 GMT
  11. Lines: 19
  12.  
  13. In article <1992Sep3.210532.22036@tc.cornell.edu> elan@tasha.cheme.cornell.edu (Elan Feingold) writes:
  14. >
  15. >In a program I'm writing, after I fclose() a file, it seems to mess up the free space of the core, and I'm really not sure why.  It seems that this sequence of events messes up the memory.
  16. >
  17. >1. Open file
  18. >2. Allocate and deallocate memory
  19. >3. Close file
  20.  
  21. Not sure if this is the case here, but doing "fclose" after an "open",
  22. or a "close" after a "fopen" frequently crash the system with some 
  23. compilers. It's a good idea to get into a habit of always using one
  24. pair and never the other.
  25.  
  26. Also closing a NULL file ptr (probably after a failed open) could
  27. be problematic as well.
  28.  
  29.  Ya-Gui Wei
  30.  
  31.  
  32.