Write function read file