Reading from file
Posted on 2003-02-19
I have two servers, one java (server1), one C++ (server2).
I wish server 2 to read from a text file. Entries are written to the file by server1 in the format:
Received from user : IP : at time xx.yy.zz
Each entry is appended so that there may be several lines of the above in a single session.
I want a certain action to be performed every time an entry is read, i.e. line by line. So when server2 reads the first entry, it performs the action. The next time I want it to check the next line in the file for an entry (which may or may not be there) so as not to keep reading the first entry and performing the action.
How do I accomplish this: Here is my code so far:
cerr << "File could not be opened" << endl;
while(ComplaintFile >> s)
QLevel += QLevel; // action performed for each entry