'How to revome a directory (folder) in c++ . I am using rmdir(); but it doesn't work properly

Here is the part of my code.

cin>>batch_serial;

    makefilename=".//studentData//batch"+to_string(batch_serial);
        filename=&makefilename[0];
        cout<<filename;                 //bug
        if(rmdir(filename)==0)
        {
            cout<<"Batch removed Succecfully";
        }
        else
            cout<<"Couldn't remove Batch";


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source