bool TFIn::GetNextLnBf(TChA& LnChA) { int Status; int BfN; // new pointer to the end of line int BfP; // previous pointer to the line start bool CrEnd; // last character in previous buffer was CR LnChA.Clr(); CrEnd = false; do { if (BfC >= BfL) { // reset the current pointer, FindEol() will read a new buffer BfP = 0; } else { BfP = BfC; } Status = FindEol(BfN,CrEnd); if (Status >= 0) { if (BfN-BfP > 0) { LnChA.AddBf(&Bf[BfP],BfN-BfP); } if (Status == 1) { // got a complete line return true; } } // get more data, if the line is incomplete } while (Status == 0); // eof or the last line has no newline return !LnChA.Empty(); }
// Gets the next line to LnChA. // Returns true, if LnChA contains a valid line. // Returns false, if LnChA is empty, such as end of file was encountered. bool TZipIn::GetNextLnBf(TChA& LnChA) { int Status; int BfN; // new pointer to the end of line int BfP; // previous pointer to the line start LnChA.Clr(); do { if (BfC >= BfL) { BfP = 0; } // reset the current pointer, FindEol() will read a new buffer else { BfP = BfC; } Status = FindEol(BfN); if (Status >= 0) { LnChA.AddBf(&Bf[BfP],BfN-BfP); if (Status == 1) { return true; } // got a complete line } // get more data, if the line is incomplete } while (Status == 0); // eof or the last line has no newline return !LnChA.Empty(); }