opening a file based on user input c++
问题 I am trying to make a program that would open a file based on the users input. Here`s my code: #include <iostream> #include <fstream> #include <string> using namespace std; int main() { string filename; ifstream fileC; cout<<"which file do you want to open?"; cin>>filename; fileC.open(filename); fileC<<"lalala"; fileC.close; return 0; } But when I compile it, it gives me this error: [Error] no match for 'operator<<' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'const