change file open mode and convert the string read in to a integer