dBASE.NET icon indicating copy to clipboard operation
dBASE.NET copied to clipboard

Table reading does not skip deleted rows, missing property of row deletion

Open b-mi opened this issue 3 years ago • 0 comments

This code help for skipping deleted rows. (for foxpro dbf)

        private void ReadRecords(BinaryReader reader, byte[] memoData)
        {
            Records.Clear();

            // Records are terminated by 0x1a char (officially), or EOF (also seen).
            while (reader.PeekChar() != 0x1a && reader.PeekChar() != -1)
            {
                try
                {
                    var isDeleted = reader.PeekChar() == 0x2a; ;
                    var rec = new DbfRecord(reader, header, Fields, memoData, Encoding);
                    if (!isDeleted)
                        Records.Add(rec);
                }
                catch (EndOfStreamException) { }
            }
        }

b-mi avatar Jun 21 '22 13:06 b-mi