Ok so I have a client server program that I wrote in c++. Took me a while! As I am not really an expert.
The problem that I encountered was following:
When I read from a file in to a string it only loads the first line into a string and that is what is will send.
I can t really figure out why doesn't it read all the lines.
If need be I can post the whole code but I figured it would be more efficient if I posted the part of the code where the problem is.
Code:
string readFile()
{
ifstream read("LOG.TXT");
string str;
int index = 0;
if (read.is_open())
{
while (!read.eof()) //Tried using read.good()
{
getline(read, str);
cout << str << endl;
return str;
}
}
else
cout << "\nEror file is closed\n";
}
Any help any advice is welcomed.