change str to str.c_str()
The function c_str() converts your std::string to a const char * which is what the constructor of fopen wants.
I personally like std::ofstream(str.c_str()) better for opening files.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Offline 4,132 posts
since Oct 2006