Problem with IO

So I was trying out a new way to get input and output with C++. I used

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    freopen("fenceplan.in".c_str(),"r", stdin);
    freopen("fenceplan.out".c_str(),"w", stdout);
}

However, I was getting the error message

fenceplan.cpp|6 col 28 error| request for member ‘c_str’ in fenceplan.in"’, which is of non-class type ‘const char [13]’                                                
fenceplan.cpp|7 col 29 error| request for member ‘c_str’ in fenceplan.out"’, which is of non-class type ‘const char [14]’

So then I got rid of the .c_str() at the end of the input and output file names and the error messages went away. My question is that why did the error message come up when I did exactly as the guide said for input and output. My other question is that what does the aforementioned function do.
Thanks!!

"fenceplan.in" is already a character string, so it doesn’t support .c_str()

Wait so does .c_str() covert a string into a string array?

yeah, it converts a std::string into a char*. see here