in reply to Save first n values from a file

Fastest way by far: You don't need to slog through an arbitrarily-long random access file just to find out what's at the end of it.