On 2 Mar 2004 07:44:19 -0800, TJK <ki**************@hotmail.com> wrote:
I'm trying to create a Folder using Visual C++ in the Visual Studio
.NET environment. So far I haven't found a successful of doing this.
The folder is to be created using a name given by the user via scanf
or cin. After this I want to be able to use fprintf to create several
files in the folder. I can write the files but don't know how to
create the folder and have the files written in the folder.
Thank you for any help you can give me
TJK
PS I'm still quite new to programming so please forgive me for when I
miss the seemingly obvious :)
I'm sure you've been told a few times now that this is off topic but here
it is:
#include <windows.h>
int main()
{
int returnValue = 0; //int variable initialized to zero
returnValue = CreateDirectory("c:\\mydirectory", NULL);
return 0;
}
NOTE: CreateDirectory returns a non zero number if succesfull.
You can call GetLastError()
if you need for more info. ALSO: notice the double \\ in c:\\mydirectory. You can do it
that way or c:/mydirectory. The second parameter is security settings for the new directory.
See MSDN for more info on that but NULL just gives it default settings.
Michael Edukonis