• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 431
  • Last Modified:

how to make directory in C++ ??

how to make directory and then create text file in C++ ?

0
Parth48
Asked:
Parth48
  • 5
  • 3
1 Solution
 
evilrixSenior Software Engineer (Avast)Commented:
0
 
evilrixSenior Software Engineer (Avast)Commented:
>> then create text file in C++ ?
http://www.cplusplus.com/reference/iostream/ofstream/
std::ofstream out("test_file.txt");
out << "test";

Open in new window

0
 
Parth48Author Commented:
can u please create one directory in C Drive using C++ program ?

please tell me via example ...
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
evilrixSenior Software Engineer (Avast)Commented:
Sure
if(0 == mkdir("c:\\temp", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH))
{
   // worked
}
else
{
   // failed
}

Open in new window

0
 
Parth48Author Commented:
i am Compile C++ program in Visual studio 2008 using win32 console application ..

now how can i create directory in C++ ?

because it give me error for mkdir function doesn't exist ..

what can i do ?
0
 
evilrixSenior Software Engineer (Avast)Commented:
If you are using Visual Studio use _mkdir (Microsoft make using standard posix functions hard work!).
http://msdn.microsoft.com/en-us/library/2fkk4dzw.aspx


if(0 == _mkdir("c:\\temp"))
{
   // worked
}
else
{
   // failed
}

Open in new window

0
 
Parth48Author Commented:
@evilrix : Thanks very much ...
0
 
evilrixSenior Software Engineer (Avast)Commented:
You are most welcome. Post back here if you have any more concerns about this :)
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now