I want to read out a file using istream::read(). However I get the error "Invalid arguments" when trying to compile in Eclipse CDT.
Code looks like this
int main(){
std::ifstream list("list", std::fstream::in);
if( list.is_open() ){
list.seekg(0, list.end );
int listlength= list.tellg();
if(1 <= listlength){
list.seekg(0, list.beg );
char* filecon = new char[listlength];
list.read( filecon, listlength);
}else{
}
}else{
}
}
Error:
Invalid arguments '
Candidates are:
std::basic_istream<char,std::char_traits<char>> & read(char *, ?)
'
For me read(char *, ?) looks like the problem. Eclipse and the compiler seem unable to get the type of the second argument. Are there some relevant settings in Eclipse that I must change? I have added the "CDT GCC Built-in Compiler Settings" to the Providers in the C/C++ General settings, but that didn't help, unfortunately.
Thanks for any help!