ex17: shortened opening and reading of file