I have a function which should output data from a file about a product which is typed in to the "keres variable. But when I am trying to compare the two strings it doesn't work.
void Admin::display_one()
{
string keres;
Admin lidl;
cout<<"Irja be a keresett termek nevet: ";
getline(cin,keres);
keres += "\r";
ifstream file("termeklista.txt");
file.read(reinterpret_cast <char*> (&lidl), sizeof(lidl));
while(!file.eof())
{
if(lidl.nev == keres)
{
....
}
file.read(reinterpret_cast <char*> (&lidl), sizeof(lidl));
.....}
I wrote some post from here, I tried many form to put the additional "\r" in the end, but I think this is not the case at "serialized" ".txt" files. In the ".txt" file, I have:
Hýb tej hýb 1$ ë d Hýb kave hýb 3$
So could you help me in figuring out what's the solution Thank you for the accorded time.