Thread: creating directories

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    98

    creating directories

    is there a function which creates all the nonexisting directories in a given path?

  2. #2
    Registered User MathFan's Avatar
    Join Date
    Apr 2002
    Posts
    190
    What system are you using? If it's Unix, here is an example:

    Code:
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    
    //...
    
    mkdir("./path/to/my/dir", 0777);
    For some other unix functions look here



    There is something similar in Windows, too. Here is an example for VC++:


    Code:
    #include <direct.h>
    
    //...
    
    _mkdir("\\mydir");
    Look here for more examples and explanations for VC++.
    The OS requirements were Windows Vista Ultimate or better, so we used Linux.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    the page on msdn's about CreateDirectory function isn't available so here's an alternative link
    http://www.answers.com/topic/createdirectory-win-api
    Last edited by xErath; 05-20-2005 at 08:31 PM.

  4. #4
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    but CreateDirectory() doesn't create more than one directory at a time.
    nvm, i created a function which does what i want, thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating and deleting directories and deleting files
    By fguy817817 in forum C Programming
    Replies: 1
    Last Post: 04-08-2009, 07:26 AM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. VC6 directories
    By Magos in forum Tech Board
    Replies: 0
    Last Post: 03-11-2005, 05:52 PM
  4. Creating files in specific directories
    By Kyoto Oshiro in forum C++ Programming
    Replies: 2
    Last Post: 03-06-2002, 08:50 PM
  5. Creating Directories?
    By dark_fusion in forum C++ Programming
    Replies: 4
    Last Post: 11-12-2001, 01:22 AM