I know that the title is a little vague but i can't think of a better title right now. The extract from my code looks like this:
#include<iostream>
#include<fstream>
int main(){
ifstream f("cuvinte.txt");
f.getline(cuvant);
return 0;
}
When i want to read the next word from "cuvinte.txt" i write f.getline(cuvant); but i get the following error
error C2661: 'std::basic_istream<_Elem,_Traits>::getline' : no overloaded function takes 1 arguments
I don't know what the issue is, and i stumbled upon this problem a while ago and still can't get past it.
I don't know what the issue is, and i stumbled upon this problem a while ago and still can't get past it.
To the reference!
basic_istream& getline( char_type* s, std::streamsize count );
You need to provide the size, i.e. the amount of available space in cuvant
.
f.getline(cuvant, size);
^^^^
An alternative would be to use more modern instruments:
string cuvant;
getline(f, cuvant);