hi has anyone know detailed info on the mkdir function plus the open dir and how to use it ?

Recommended Answers

All 3 Replies

mkdir   Creates a directory.


 Syntax:
   int mkdir(const char *path);

 Prototype in:
 dir.h

 Remarks:
mkdir creates a new directory from the given
path name path.

 Return Value:
mkdir returns the value 0 if the new directory
was created.

On error, a value of -1 is returned, and the
global variable errno is set to one of the
following values:

   Setting ³ Description
  
   EACCES  ³ Permission denied
   ENOENT  ³ No such file or directory

 Portability:
mkdir is available on UNIX System V, though it
takes an additional file-mode parameter.

 See Also:
  chdir    getcurdir    getcwd    rmdir

 Example:
 #include <stdio.h>
 #include <conio.h>
 #include <process.h>
 #include <dir.h>

 int main(void)
 {
   int status;

    clrscr();
    status = mkdir("asdfjklm");
    (!status) ? (printf("Directory created\n")) :
                (printf("Unable to create directory\n"));

    getch();
    system("dir");
    getch();

    status = rmdir("asdfjklm");
    (!status) ? (printf("Directory deleted\n")) :
                (perror("Unable to delete directory"));

    return 0;
 }

opendir() is used to begin reading the names of the files and folders stored in a directory. There is lots of information and examples around the net how to use it -- just use google. Here is one very good tutorial

thanks for the help much appreciated

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.