1

Why is it better to read a file slowly to make a seek?

//if (!read_fields[x] || !ok)
                    //{
                    //    if (l > 0) Seek(l, SeekOrigin.Current);
                    //    read[x] = null;
                    //    continue;
                    //}

                    byte[] bx = new byte[l];
                    if (l > 0) Read(bx, 0, l);

                    if (!read_fields[x] || !ok)
                    {
                        read[x] = null;
                        continue;
                    }

My speed test says that seek is very slow!

Chris Dunaway
  • 10,974
  • 4
  • 36
  • 48

1 Answers1

2

Seek - Sets the current position of this stream to the given value. Read - Reads a block of bytes from the stream and writes the data in a given buffer.

So, with seek you repositioning read position - it is time consuming process. If you simple read - you sequentially read from file.

VikciaR
  • 3,324
  • 20
  • 32