in reply to Re: New Line at End File
in thread New Line at End File


You should have pointed out that this solution will only work if there are 20 or less newlines at the end of the file.

--
John.

Replies are listed 'Best First'.
Re: Re: Re: New Line at End File
by tachyon (Chancellor) on Dec 10, 2002 at 13:52 UTC

    but that would have left nothing left to say.... I would generally read in 512 bytes anyway as this is a generally a sector and realistically the smallest chunk of a disk that the OS ever reads. This was an example and the limitation is self evident I would have thought. As it happens it will only take of the last 10 'newline' CRLF line endings on Windows if we want to get really picky ;-)

    If you want to move on to the more arcane and esoteric neither seek() nor read() for that matter can be relied upon to do exactly what you ask. From the docs....

    If you want to position file for sysread or syswrite, don't use seek-- +buffering makes its effect on the file's system position unpredictabl +e and non-portable. Use sysseek instead.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print