in reply to Re^2: Deleting all the data after a specific position in a text file.
in thread Deleting all the data after a specific position in a text file.
See the documentation for seek, specifically the WHENCE parameter.
Update: I am assuming that you mean the last 100 bytes, not characters.
Update 2: Specifically, seek to position 100 from the end, and tell what the current position is, then truncate to that length. ISTR (but cannot recall at the moment) a syscall to "truncate from this point to the end of the file". Oops, just use the FH version of truncate. See also Re^3: Deleting all the data after a specific position in a text file..
--MidLifeXis
|
|---|