944,150 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 41955
  • C++ RSS
Mar 11th, 2005
0

make directory

Expand Post »
How can i create a directory in c++ other than writing
C++ Syntax (Toggle Plain Text)
  1. system ("md directory");
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
xfruan is offline Offline
12 posts
since Mar 2005
Mar 11th, 2005
0

Re: make directory

Linux
C++ Syntax (Toggle Plain Text)
  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
C++ Syntax (Toggle Plain Text)
  1. #include <windows.h>
  2.  
  3. CreateDirectory (char *DirName, SECURITY_ATTRIBUTES Attribs);
If the function succeeds returns non-zero otherwise NULL.
Reputation Points: 47
Solved Threads: 17
Posting Whiz in Training
Tight_Coder_Ex is offline Offline
215 posts
since Feb 2005
Mar 14th, 2005
0

Re: make directory

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".
Reputation Points: 10
Solved Threads: 0
Newbie Poster
xfruan is offline Offline
12 posts
since Mar 2005
Mar 14th, 2005
0

Re: make directory

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.
Reputation Points: 47
Solved Threads: 17
Posting Whiz in Training
Tight_Coder_Ex is offline Offline
215 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Novice wants to improve skills
Next Thread in C++ Forum Timeline: Passing Arrays to function in Visual C++





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC