make directory

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2005
Posts: 12
Reputation: xfruan is an unknown quantity at this point 
Solved Threads: 0
xfruan xfruan is offline Offline
Newbie Poster

make directory

 
0
  #1
Mar 11th, 2005
How can i create a directory in c++ other than writing
  1. system ("md directory");
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 199
Reputation: Tight_Coder_Ex is an unknown quantity at this point 
Solved Threads: 14
Tight_Coder_Ex's Avatar
Tight_Coder_Ex Tight_Coder_Ex is offline Offline
Junior Poster

Re: make directory

 
0
  #2
Mar 11th, 2005
Linux
  1. #include <sys/stat.h>
  2.  
  3. mkdir (const char *path, mode_t mode);
in this case mode = O_CREAT. Function returns an int. Lookup "man mkdir", if memory serves me correctly for more details.

Windows
  1. #include <windows.h>
  2.  
  3. CreateDirectory (char *DirName, SECURITY_ATTRIBUTES Attribs);
If the function succeeds returns non-zero otherwise NULL.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 12
Reputation: xfruan is an unknown quantity at this point 
Solved Threads: 0
xfruan xfruan is offline Offline
Newbie Poster

Re: make directory

 
0
  #3
Mar 14th, 2005
Problem is when i tried both ways in Visual C++, neither of the methods worked, in both cases, the compiler told me there is no such an include file. Instead, i found a function "mkdir (const char*)" in the include file called "direct.h".
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 199
Reputation: Tight_Coder_Ex is an unknown quantity at this point 
Solved Threads: 14
Tight_Coder_Ex's Avatar
Tight_Coder_Ex Tight_Coder_Ex is offline Offline
Junior Poster

Re: make directory

 
0
  #4
Mar 14th, 2005
If you not too concerned about the bells and whistles that go along with 95/98/XP then mkdir will work just fine.

If you are creating projects in VC++ 6.0 with the wizzard and "stdafx.h" is already included you don't have to worry about <windows.h> because it's already in there.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC