Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 24-11-2009
Member
 
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.
Reply With Quote
  #2  
Old 24-11-2009
Member
 
Join Date: May 2008
Posts: 2,008
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.
Reply With Quote
  #3  
Old 24-11-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
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.
Reply With Quote
  #4  
Old 24-11-2009
Member
 
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);
}
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Create a folder using C++ language"
Thread Thread Starter Forum Replies Last Post
not getting list of options to create new folder, detail of any folder, in windows xp veeru4598 Operating Systems 2 17-02-2011 11:21 AM
How to create invisible folder Jackie Customize Desktop 7 15-05-2010 06:10 PM
lynda.com Player is unable to create its folder in the "My Documents" folder Coolestman Windows Software 4 19-02-2010 04:10 PM
Create a folder without name. Rohit Kasle (RK) Tips & Tweaks 1 04-02-2010 08:52 PM
What language to create a MUD? T TelDa Software Development 5 20-03-2009 12:54 PM


All times are GMT +5.5. The time now is 01:30 AM.