You've got the right idea but your algorithm is shittily inefficient. The classical (tried and true) solution is to load blocks, one at a time, starting with the last, and search backwards in the block until the marker is found. This solution involves doing some math (to calculate pos from block size and count), but it's much more efficient than using seek.
In reply to Re^4: Delete last line of file with regex
by Anonymous Monk
in thread Delete last line of file with regex
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |