how to make folders

Alright Now I know in order to make a folder you have to do the following correct me if I am wrong please

1
2
3
4
5
6
    #include <direct.h>
    int main()
    {
          mkdir("c:/myfolder");
          return 0;
    }




but would he same things stand in order to name it what the user types


1
2
3
4
5
6
7
8
9
10
11
12
	

    #include<iostream>
    #include <string>
    #include <direct.h>
    int main()
    {
          string foldername;
          cin>>foldername
          mkdir("c:/foldername");
          return 0;
    }
Use a string to construct the result you want pass the mkdir().

std::string some_str = "stuff";
std::cout<< std::string("some ") + some_str < "\n";[/code]

If mkdir() expects as C-style string, you'll want to use the c_str() method of the string class.
im not understanding what you mean ?
Topic archived. No new replies allowed.