If you're reading each line as soon as it is appended to the file, there won't be a newline.

But we are not reading the lines, we are just seeking to the EOF. How do we guarantee that we are fast enough? (I am not sure if the system or just the program is overwhelmed by size of lines.)

Let MAX be seven. N is a newline. The following data arrives.

1...N.........9........N.2N...............f....x15

We capture the line containing 1. We start on the next line but give up before we get to character 9; so we seek on the file and end up at x15; then we read back to about f. How can we ever be sure that we are not missing one or more lines in the area of 2?

I feel confident there is a race condition but it has been more than a decade since I've seeked on any file in any language.

Be well,
rir


In reply to Re^6: Reading files, skipping very long lines... by rir
in thread Reading files, skipping very long lines... by Excalibor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.