Thread: making dir

  1. #1
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501

    making dir

    this may sound stupid, but how do you make a directory?

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    It depends on the OS, what are you running.

    Linux and Windows can be found with a search.

  3. #3
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115
    int _mkdir( const char *dirname );
    or
    int _wmkdir( const wchar_t *dirname );


    Return Value:
    Each of these functions returns the value 0 if the new directory
    was created. On an error the function returns –1 and
    sets errno as follows:

    EEXIST - Directory was not created because dirname is
    the name of an existing file, directory, or device

    ENOENT - Path was not found

    Parameter
    dirname - Path for new directory

    Remarks:
    The _mkdir function creates a new directory with the specified
    dirname. _mkdir can create only one new directory per call, so
    only the last component of dirname can name a new directory.
    _mkdir does not translate path delimiters. In Windows NT,
    both the backslash ( \) and the forward slash (/ ) are valid
    path delimiters in character strings in run-time routines.

    _wmkdir is a wide-character version of _mkdir; the dirname
    argument to _wmkdir is a wide-character string. _wmkdir and
    _mkdir behave identically otherwise.
    From the visual c++ help files
    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

  4. #4
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    I am using linux, I found a mkdir function but what is the second arg?

  5. #5
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218
    Code:
    #include <stdlib.h>
    
    int main()
    {
            system("mkdir directory");
    }
    Easy as pi

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    102
    Use mkdir() function.
    Saravanan.T.S.
    Beginner.

  7. #7
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    oh, the man page confused me umask, I get the permissions, in octal like that, thanx.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 04-25-2007, 02:48 PM
  2. Making great graphics
    By MadCow257 in forum Game Programming
    Replies: 1
    Last Post: 02-20-2006, 11:59 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Replies: 2
    Last Post: 01-13-2003, 01:28 PM