Reading up to n bytes from a file