Results 1 to 4 of 4

Thread: Create a folder using C++ language

  1. #1
    Join Date
    Nov 2009
    Posts
    124

    Create a folder using C++ language

    I am studying in T.Y.B.Sc.I.T and I am working on a Employee management project. I want to know is there any function to create new folder in a hard disk using C++. I want to save my employee information in that folder but I don't know how to create a new folder. If anybody have answer, please give me.

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

    Re: Create a folder using C++ language

    #include<iostream.h>
    #include<sys/stat.h>
    #include<sys/types.h>
    using namespace std;

    main()
    {

    if(mkdir("pathname",0777)==-1)
    {
    cerr<<"Error : "<<strerror(errno)<<endl;
    exit(1);
    }

    }


    This code help you to create new folder.

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

    Re: Create a folder using C++ language

    #include <direct.h>
    #include <iostream.h>
    int main()
    {
    mkdir("d:/emp");
    return 0;
    }

    This is easy code to create new folder.

  4. #4
    Join Date
    Nov 2005
    Posts
    1,323

    Re: Create a folder using C++ language

    #include <iostream.h>
    #include <direct.h>

    int main(int argc, char** argv)
    {
    if (argc < 2)
    {
    std::cerr << "Usage: " << argv[0] << " [new folder name]\n";
    return(EXIT_FAILURE);
    }

    if (mkdir(argv[1]) == -1)
    {
    std::cerr << "Error: " << strerror(errno);
    return(EXIT_FAILURE);
    }
    }

Similar Threads

  1. Replies: 2
    Last Post: 17-02-2011, 11:21 AM
  2. How to create invisible folder
    By Jackie in forum Customize Desktop
    Replies: 7
    Last Post: 15-05-2010, 06:10 PM
  3. Replies: 4
    Last Post: 19-02-2010, 04:10 PM
  4. Create a folder without name.
    By Rohit Kasle (RK) in forum Tips & Tweaks
    Replies: 1
    Last Post: 04-02-2010, 08:52 PM
  5. What language to create a MUD?
    By T TelDa in forum Software Development
    Replies: 5
    Last Post: 20-03-2009, 12:54 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,558,866.75450 seconds with 16 queries