Creating Directories?

This is a discussion on Creating Directories? within the C++ Programming forums, part of the General Programming Boards category; How do I create a directory or folder using C++?...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    8

    Question Creating Directories?

    How do I create a directory or folder using C++?

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb Here's the answer:

    first, #include <stdlib.h>

    then, under int main() {

    system("mkdir Name");

    I hope this helps
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    8
    but what if I wanted to create it on another drive like A: would the coding be something like this?

    system("A: mkdir name");

    coz I tried that but it wouldnt work.

  4. #4
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb Oooohhhh...Here's how to do that:

    To create it on another drive, just #include <stdlib.h>, then I have, say, a folder named example:

    to put 'example' on A:\

    system("mkdir a:/example");
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    You can also use:

    #include <dir.h>
    .
    .
    mkdir("a:\\dir_name");

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. creating directories
    By hiya in forum C++ Programming
    Replies: 3
    Last Post: 05-21-2005, 12:08 AM
  4. Working with directories...
    By C Seņor in forum C Programming
    Replies: 4
    Last Post: 04-20-2002, 11:45 AM
  5. Creating files in specific directories
    By Kyoto Oshiro in forum C++ Programming
    Replies: 2
    Last Post: 03-06-2002, 07:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21