read num bytes used from file instead of calculating manually