home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1758 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  2.3 KB

  1. From: nbladt@aut.UUCP (Norbert Bladt)
  2. Newsgroups: alt.sources
  3. Subject: Re: ELVIS WARNING - LOST CLUSTERS ON PC's
  4. Message-ID: <689@aut.UUCP>
  5. Date: 31 Aug 90 06:59:53 GMT
  6.  
  7. tjr@cbnewsc.att.com (thomas.j.roberts) writes:
  8.  
  9. >Following up to my previous posting on successfully building elvis:
  10.  
  11. >BEWARE! elvis is NOT cleaning up properly - it leaves LOST CLUSTERS
  12. >on the temp disk. In my case this is a RAMDISK, and I did not check
  13. >it after initially playing with elvis. elvis appears to work fine -
  14. >I have used most of its commands, and it appears to be a VERY faithful
  15. >clone of vi. I have no idea why it creates lost clusters in the
  16. >temp disk, but that makes it HIGHLY SUSPECT. Others have reported
  17. >similar problems using Quick C (I used Turbo C).  Good Luck!
  18.  
  19. I had the same problem with a program ported from UNIX to MS-DOS.
  20. On UNIX (every flavour) it is possible to do the following (this
  21. may not be correct on UNIX, just to give you the idea what happens,
  22. no runtime checks included):
  23.  
  24.  
  25.     char *TmpFileName, mktemp();
  26.     FILE TmpFile, fopen();
  27.  
  28.         /* Create a unique name for temp. file */
  29.     TmpFileName = mktemp ("/tmp/pipapoXXXXXX");
  30.  
  31.         /* open temp. file */
  32.     TmpFile = fopen (TmpFileName, "r+");
  33.  
  34.     unlink (TmpFileName);    /* delete temporary file.
  35.                    However, it is NOT deleted,
  36.                    because it has been opened by
  37.                    an application, i.e. this program !
  38.                 */
  39.  
  40.     /* Do the usual fread and fwrite operations here */
  41.  
  42.     exit();    /* this will close and delete the temporary file */
  43.  
  44. If you do this on MS-DOS it will create lost clusters.
  45. On VMS it simply doesn't work (error reported by unlink).
  46. If you ignore the error code of the unlink (which most programs do :-( )
  47. the temporary file is still existing after your application did exit.
  48. Since it is the temp disk you are having problems with, this rang a bell
  49. in me.
  50.  
  51. Perhaps this part of the code is wrong in that way. I had a lot of problems
  52. with this programming style on MS-DOS and VMS.
  53.  
  54. I have saved the elvis code but did not yet take a look at it. My comments
  55. are just a guess, though.
  56.  
  57. >Tom Roberts
  58. Norbert Bladt.
  59. -- 
  60. Please use this path as return address. DON'T USE THE RETURN PATH IN THE HEADER
  61. Norbert Bladt, Ascom Autelca AG, Worbstr. 201, CH-3073 Guemligen, Switzerland
  62. Phone: +41 31 52 92 14
  63. EMail: ..!uunet!mcsun!chx400!hslrswi!bladt
  64.