Download presentation
Presentation is loading. Please wait.
1
Reading and Writing Text Files
MIS 3406 Department of MIS Fox School of Business Temple University
2
The Basics Reading from a file Writing to a file Deleting a file
3
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
4
Writing to a file Get set up to access the file system
Write records to the file
5
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
6
Searching through a directory for files
Get set up to access the file system Call fs.readdirSynch Step through the files in the array
7
Challenges FileDisplay HeadFileDisplay TailFileDisplay LineNumbers
ItemCounter SumOfNumbers AverageOfNumbers MyDIR2 RandomFileWriter RandomFileReader GolfScores1 GolfScores2 AverageStepsTaken ChargeAccountValidation DriverLicenseExam NameSearch PopulationData WorldSeriesChampions Magic8Ball GuessANumber
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.