Implementation
Python

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
Truncate(F);
use Path::Tiny qw(path);
my $F = path('F')->openrw;
# ... read some from $F to advance
# position of file handle (not shown) ...
truncate $F, tell $F;
F.truncate(F.pos)
using System.IO;
var F = new FileStream("F", FileMode.Open)
// advance into F here
F.SetLength(F.Position);