home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / actlib12.zip / TOOLS.ZIP / MKPATH.C < prev    next >
C/C++ Source or Header  |  1993-02-25  |  478b  |  30 lines

  1. /*  Copyright (C) 1993   Marc Stern  (internet: stern@mble.philips.be)  */
  2.  
  3. #include "tools.h"
  4. #include <string.h>
  5. #include <direct.h>
  6.  
  7. /*
  8.  *    mkpath()
  9.  *
  10.  *    Input:  dir - the directory to be created
  11.  *
  12.  *    Comments: creates destination directory
  13.  */
  14.  
  15. int mkpath(char *dir)
  16.  
  17. { char *p;
  18.  
  19.   for ( p = dir; p = strchr(p, '\\'); *p++ = '\\' )
  20.       {
  21.         *p = '\0';
  22.         mkdir( dir );
  23.      }
  24.  
  25.   if ( mkdir(dir) == -1 ) return -1;
  26.   
  27.   return 0;
  28. }
  29.  
  30.