Zablokowalem sie, od 10 min slecze nad tym kodem. Błąd jest gdzies tu while (getline(myfile, linia))
no matching function for call to 'getline(std::ofstream&, std::string&)'|
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
string imie, nazwisko;
int tel;
int main()
{
ofstream myfile;
myfile.open ("example.txt",ios::in);
if(myfile.good()==false)
{
cout<<"Plik nie istnieje";
exit(0);
}
string linia;
int nr_linii=1;
while (getline(myfile, linia))
{
switch(nr_linii)
{
case 1: imie = linia; break;
case 2: nazwisko = linia; break;
case 3: tel = atoi(linia.c_str()); break;
}
nr_linii++;
}
myfile.close();
cout << imie << endl << nazwisko << endl << tel << endl ;
return 0;
}