home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / RDQWKSRC.ZIP / SYSTEM.C < prev    next >
C/C++ Source or Header  |  1991-01-15  |  1KB  |  56 lines

  1. /*
  2.             DOS System-Dependant functions for Read.c
  3. */
  4.  
  5.  
  6. #include <dos.h>
  7.  
  8. /*
  9.            Deletes ALL files in a directory pointed by PathName.
  10.            This is system-dependant.
  11. */
  12.  
  13. void Erase(PathName )
  14.  char *PathName;
  15. {
  16.  char tmp[127];
  17.  char Pattern[127];
  18.  int ok;
  19.  
  20.   struct DocFile                            /* MSC et Turbo under DOS use   */
  21.                {                            /* different names. Here are my */
  22.                 char     Reserved[21];      /* own for both two, and a nice */
  23.                 char     attr;              /* warning... :-)               */
  24.                 unsigned Time;
  25.                 unsigned Date;
  26.                 long     Len;
  27.                 char     Name[13];
  28.                } FileDoc;
  29.  
  30.  
  31.  
  32. sprintf(Pattern,"%s\\*.*",PathName );
  33.  
  34. #ifdef __TURBOC__
  35.    ok= findfirst(Pattern,&FileDoc,0);
  36. #else
  37.    ok= _dos_findfirst(Pattern,0,&FileDoc);
  38. #endif
  39.    if(ok!=0) return;
  40.  
  41.   while(!ok)
  42.        {
  43.          sprintf(tmp,"%s\\%s",PathName,FileDoc.Name);
  44.          unlink(tmp);
  45. #ifdef __TURBOC__
  46.          ok= findnext(&FileDoc);
  47. #else
  48.          ok= _dos_findnext(&FileDoc);
  49. #endif
  50.        }
  51.  
  52. }
  53. /*-------------------------------------------------------------------------*/
  54.  
  55.  
  56.