Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory

Status
Not open for further replies.

tzzdvd

Programmer
Aug 17, 2001
52
IT
I want to create a directory and I use
_mkdir(".\\mydir");
but it doesn't work. I have this error :&quot;_mkdir: undeclared identifier&quot; but I used <direct.h>. What's the problem?
Is there another way to create a new directory?
Thank's
Davide

P.S. If I project a dos program it works.
 
#include <windows.h>
#include <iostream>

int main()
{

char sDir[] = &quot;C:\\__NEW_DIR__&quot;;

if ( !CreateDirectory( sDir,NULL ) )
std::cout << sDir
<< &quot; could not be created.&quot;;
else
std::cout << &quot;Success.&quot;
<< std::endl;

return 0;

} Mike L.G.
mlg400@blazemail.com
 
Did you maybe put <direct.h> before #include &quot;stdafx.h&quot;? If so it will be ignored if you are using the usual VC++ precompiled headers.

:) Hope that this helped! ;-)
 
Dear DavesTips,
it's true, i dit put <direct.h> before &quot;stdafx.h&quot;.
After changing the order it works!!!!

Thank's very much
Davide
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top