error no instance of overloaded function "getline" matches the argument list
I cant seem to see what is wrong. I feel like I am passing the correct arguments (ie the std::ofstream
and the std::string
). Any help would be great thanks.
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main () {
ofstream myfile;
ofstream yourFile;
myfile.open ("read.cc");
yourFile.open ("write.cpp");
string line;
This section in particular is the one that is getting an error.
if (myfile.is_open()){
The getline in the while loop is red and is giving me the overload error.
while(getline(myfile,line)){
yourFile << line <<"\n";
}
}
myfile.close();
yourFile.close();
return 0;
}
I thought I had set up the streams correctly.