Get Directory from User
I'm looking for a function to get a directory path from the user; I need to solicit a place to put things. I tried using GetOpenFileName() with .dir as a filter but no joy. I found something called GetDirectoryVia开发者_如何学编程Browse() that sounds like it might do what I want but it's part of some wizard making package and my Visual Studio knows nothing about it. I'd like some simple non .NET widget.
Is there such a thing?
You are looking for the Win32 Shell API: SHBrowseForFolder
you can use mkdir("your path") this function is in library. here is a sample code:
#include <direct.h>
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char folder[50];
char path[]="c:/";
cin>>folder;
strcat(path,folder);
mkdir(path);
cout<<"Your folder has been created in drive C.";
return 0;
}
精彩评论