home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / mikmod43.zip / WILDFILE.C < prev    next >
C/C++ Source or Header  |  1994-04-28  |  1KB  |  63 lines

  1. /*
  2.     WILDFILE.C
  3.  
  4.     Some routines to support wildcard filename handling.. Done by MikMak
  5. */
  6.  
  7. #include <stddef.h>
  8. #include <dir.h>
  9. #include "wildfile.h"
  10.  
  11. char path[MAXPATH];
  12. char drive[MAXDRIVE];
  13. char dir[MAXDIR];
  14. char name[MAXFILE];
  15. char ext[MAXEXT];
  16.  
  17. struct ffblk ffblk;
  18.  
  19.  
  20. char *GetFirstName(char *wildname)
  21. /*
  22.     Finds the first file in a directory that corresponds to the wildcard
  23.     name 'wildname'.
  24.  
  25.     returns:    ptr to full pathname
  26.  
  27.                 or
  28.  
  29.                 NULL if file couldn't be found
  30. */
  31. {
  32.     int found;
  33.  
  34.     fnsplit(wildname,drive,dir,name,ext);
  35.  
  36.     if(!findfirst(wildname,&ffblk,0)){
  37.         fnmerge(path,drive,dir,ffblk.ff_name,NULL);
  38.         return path;
  39.     }
  40.     return NULL;
  41. }
  42.  
  43.  
  44. char *GetNextName(void)
  45. /*
  46.     Finds another file in a directory that corresponds to the wildcard
  47.     name of the GetFirstName call.
  48.  
  49.     returns:    ptr to full pathname
  50.  
  51.                 or
  52.  
  53.                 NULL if file couldn't be found
  54. */
  55. {
  56.     if(!findnext(&ffblk)){
  57.         fnmerge(path,drive,dir,ffblk.ff_name,NULL);
  58.         return path;
  59.     }
  60.     return NULL;
  61. }
  62.  
  63.