Re: how to create directory in c++
Quote:
Originally Posted by bhas_purk
i had to create directories in windows using VC++
I can get CreateDirectory to work only when the path is like " c:/face"
If I give "c:/face/images" it doesnt create the folder, not even face, any help would be appreciated.
if I have c:/face created then it creates ./image also :?
You'll need to iteratively create enclosed folders: first c:/face, then c:/face/images.
Re: how to create directory in c++
CreateDirectory() can only be used to create the final directory, if one or more intermediate directories do not exist, CreateDirectory() will fail with an error 3.
You may use SHCreateDirectoryEx() indeed, this fuction will generate a folder and its sub folders.
Re: how to create directory in c++
The thread that won't die. :confused: :eek:
Re: how to create directory in c++
Re: how to create directory in c++
I know this is an old thread but this solution will work in both Windows and Linux.
char sysText[256];
sprintf( systext, "mkdir %s", path ); // path is a char * to the string representing the directory you want to create
system( systext );
Re: how to create directory in c++
Quote:
Originally Posted by
whittenrob
Code:
char sysText[256];
sprintf( systext, "mkdir %s", path ); // path is a char * to the string representing the directory you want to create
system( systext );
Why that complicated? :confused: As already has been posted in this thread (long time ago), the C++ runtime has a mkdir() function on both *nix and Windows. ;)
Re: how to create directory in c++
I am having some difficult times with this too.
my code in MS Visual C++ 6.0 looks like
char dirname[FILENAME_MAX] = {"c:\\new_directory\\"};
int erc;
erc = mkdir(dirname);
so far it works fine.
.....................................
I am trying to do the same thing using MS Visual C++ 2010 Express
the same set of instructions are not accepted, is there something I should add/change?
thanks in advance
Re: how to create directory in c++
Re: how to create directory in c++
I got back this
'_mkdir': identifier not found
could you please help me with the include file name, maybe it has changed ....
Re: how to create directory in c++
Re: how to create directory in c++
You can create directory in windows by using dis code ...................... jst pass da name of folder using char array
#include<iostream>
using namespace std;
void main()
{
system("mkdir D:foldername");
}
Re: how to create directory in c++
Quote:
You can create directory in windows by using dis code ...................... jst pass da name of folder using char array
#include<iostream>
using namespace std;
void main()
{
system("mkdir D:foldername");
}
:rolleyes:
Re: how to create directory in c++
Quote:
Originally Posted by
GCDEF
Quote:
You can create directory in windows by using dis code ...................... jst pass da name of folder using char array
#include<iostream>
using namespace std;
void main()
{
system("mkdir D:foldername");
}
:rolleyes:
Well, [email protected] seems to be not a reader, he/she is a writer! :D
Re: how to create directory in c++
Quote:
Originally Posted by
VictorN
i m reader too
i m nt a linux user
and btw system("dos comands");
alows u to copy , move , and delete dir even so it a wide way open to use MS-DOS comands
Re: how to create directory in c++
Quote:
Originally Posted by
exsan
I got back this
'_mkdir': identifier not found
could you please help me with the include file name, maybe it has changed ....
its works like
void main (){
system("mkdir C:\\folder name");
}
u can pass folder name wid char array