Unable to create a folder with differant names

if (adminresponse == 3)

{
char module;
cout << "Enter Module Name";
cin >> module;
mkdir(module); <- I get the error in this line. the error line is marked under module. The error it throws is "Error: Argument of type "char" is incompatible with parameter of type "const char*" . Please help me to fix this issue.
}
You've defined module to be a char rather than a string.
Hello thank you for your reply. I have tried it with string as well and I get the same error for string.
Hello thank you for your reply. I have tried it with string as well and I get the same error for string.

Actually, you get a different error. mkdir is a C function that expects a pointer to a C-style string. Provide one.

1
2
3
4
5
6
7
    if (adminresponse == 3)
    {
        string module;
        cout << "Enter Module Name";
        cin >> module; 
        mkdir(module.c_str()); 
    }
Last edited on
Topic archived. No new replies allowed.