Results 1 to 5 of 5

Thread: Implementation of mkdir() : C

  1. #1
    Join Date
    Dec 2009
    Posts
    33

    Implementation of mkdir() : C

    Hello, I am student of the BscCS. I have the knowledge of the C language. Actually I would like to create the directory on my computer using the C program. But, I do not know anything about the function that can be used in the C language to create the directory. So, I would like to know about the Implementation of the mkdir() function in C language. I also would like to know how can I implement the mkdir() function in my C program to create the directory. Anyone has the solution for me on the mkdir() function reply me!!

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    The mkdir() : C

    Hi, To create the new directory in the c programming the the mkdir() function can be used with name of the path. The path name could be related to an absolute path name or to the current directory that can be working. You can be able to set the permission bits to the file of the newly created directory from mode. The mkdir() function is the well known function that can be used by the programmers to create their own directory. I hope it would be enough for you to know about the mkdir() function.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Implementation of mkdir() : C

    The mkdir() function can be used for to create the sub-directory. The syntax of the mkdir() function can be as follows :
    #include <sys/types.h>
    #include <sys/stat.h>
    int mkdir( const char *pth, md_s mod );
    the mkdir() function can returns the zero if there can be success and returns the -1if there an error can occurred. The errno can be set to state the error.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Implementation of mkdir() : C

    The following program demonstrates you how can you create the directory. In following code a new directory called /mcom on node 3 :
    #include <sys/types.h>
    #include <sys/stat.h>
    void main()
    {
    mkdir( "//3/hd/mcom", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH );
    }

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Implementation of mkdir() : C

    The mkdir() function can mark for update the satim, sctim and smtim fields of the directory, Upon the successful completion. The directory that can contains the new entry can be marked for the update whose parameters are the sctim and smtim fields.
    The following can be the list of the errors :
    1. EACCES
    2. EEXIST
    3. EMLINK
    4. ENAMETOOLONG
    5. ENOENT
    6. ENOSPC
    7. ENOSYS
    8. ENOTDIR
    9. EROFS

Similar Threads

  1. Implementation of vprintf() : C
    By Adolfa in forum Software Development
    Replies: 4
    Last Post: 28-01-2010, 02:07 PM
  2. Implementation of vsscanf() : C
    By Garrett in forum Software Development
    Replies: 4
    Last Post: 28-01-2010, 10:58 AM
  3. Mkdir with variable space
    By Kingfisher in forum Software Development
    Replies: 5
    Last Post: 19-12-2009, 11:55 AM
  4. Error mkdir() in PHP
    By GlassFish in forum Software Development
    Replies: 3
    Last Post: 28-11-2009, 10:33 AM
  5. mkdir with date
    By tom.henricksen@gmail.com in forum Windows Server Help
    Replies: 4
    Last Post: 17-03-2007, 12:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,527,700.94670 seconds with 17 queries