-
User created folders
Hi, Im kind of new to c++ and need a little help.
Im trying to make my program allow the user to enter a name and then create a folder using that name.
I tried
Code:
string name;
cout << "please enter a name... " << endl;
cin >> name;
system (""mkdir " << name");
but it gives an error on the system line, please help.
-
System() has gotten awfully popular lately and for bad, bad reasons. You should really search for different ways to do this.
You could download and use a library, for instance.
http://www.informit.com/guides/conte...eqNum=245&rl=1
-
whats wrong with the system() comand
-
You can read this article to find out. It focuses on using system to pause the program, but the article will show you what's wrong with system entirely.
-
I really dont understand that much about c++ so using a new library is kind of confusing. Can anyone help explain how to let a user pick the folder name without a new library. Im sure it would use the system("mkdir") command.
-
I also suggest you don't use system, but of course it is possible.
Code:
string name;
string cmd;
cout << "please enter a name... " << endl;
cin >> name;
cmd = "mkdir " + name;
system(cmd.c_str());
-
How about something radical, like maybe the mkdir() API call instead?