The file pointer is present at the EOF and I want to remove the last 100 characters. | [reply] |
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..
| [reply] [d/l] |