Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 8.1-File Access and Pseudocode Critical Review When a program needs to save data for later use, it writes the data in a file. The
Lab 8.1-File Access and Pseudocode Critical Review When a program needs to save data for later use, it writes the data in a file. The data can be read from the file at a later time Three things must happen in order to work with a file. 1) Open a file. 2) Process the file. 3) Close the file An internal file must be created for an output file or input file, such as Declare OutputFile myFile //to write out Declare InputFile myFile //to read in A data file must also be created to store the output, such as Open myEile "thedata.txt" New keywords and syntax include the following Open [InternalName EileNamel Write [InternalName] String or Data] Read [InternalNamel Datal Close InternalName] AppendMode /used with Open when need to append Loops are used to process the data in a file. For example For counter = 1 to 5 Display "Enter a number:" Input number Write myFile number End For When reading information from a file and it is unknown how many items there are, use the eof function. For example While NoT eof (myFile) Read myFile number Display number End While
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started