Reading and Writing Text Files MIS 3406 Department of MIS Fox School of Business Temple University
The Basics Reading from a file Writing to a file Deleting a file
Reading from a file Get set up to access the file system Read the file, split it into records and store in an array Step through the array to access the contents
Writing to a file Get set up to access the file system Write records to the file
Deleting a file Get set up to access the file system We can see the file exists Make sure the file exists before trying to delete it Delete the file Run the script The file is gone
Searching through a directory for files Get set up to access the file system Call fs.readdirSynch Step through the files in the array
Challenges FileDisplay HeadFileDisplay TailFileDisplay LineNumbers ItemCounter SumOfNumbers AverageOfNumbers MyDIR2 RandomFileWriter RandomFileReader GolfScores1 GolfScores2 AverageStepsTaken ChargeAccountValidation DriverLicenseExam NameSearch PopulationData WorldSeriesChampions Magic8Ball GuessANumber