Programs process and use ____. When the program finishes, or is closed, any data it held is lost. To prevent loss, data can be stored in a ____ so that it can be accessed again at a later date. Files have two modes of operation: 1. ____, where the file is opened so that data can be read from it. 2. Write, where the file is opened so that data can be ____ to it. Each item of data written to or from a file is called a record. Files have ____ modes of operation - read from and write to. Opening and closing files A file must be ____ before a record can be read from or written to it. To open a file, it must be referred to by its ____ (name), for example: file = openRead("scores.txt") This would open the ____ scores.txt and allow its contents to be ____ file = openWrite("scores.txt") This would open the file scores.txt and allow it to have data ____ to it. file.close() This would ____ the file. Reading from a file Once a file has been opened, the records are read from it one line at a time. The data held in this record can be ____ into a variable, or, more commonly, an ____ (list), for example: file = openRead("scores.txt") score = myFile.readLine() file.____ An array example is shown below: ____ = openWrite("scores.txt") for x = 0 to 9 scores____ = myFile.readLine() ____ file.close() End of file When reading a file that has more than one record, the computer needs to know what to do when there are no more records to ____. The endOfFile() statement checks to see if the ____ record has already been read, for example: ____ = openRead("scores.txt") while NOT file.endOfFile() scores____ = myFile.readLine() x = x + 1 endwhile file.____ The above code would read each record and place it into an ____ called scores. The operations ____ when there are no more files to read. Arrays are often used to hold data read from files.
0%
2.2 Basic File Handling Operations
שתף
שתף
שתף
על ידי
Dprice7
Y10
Computing
עריכת תוכן
הדפסה
הטבעה
עוד
הקצאות
לוח תוצאות מובילות
הצג עוד
הצג פחות
לוח התוצאות הזה הוא כרגע פרטי. לחץ
שתף
כדי להפוך אותו לציבורי.
לוח תוצאות זה הפך ללא זמין על-ידי בעל המשאב.
לוח תוצאות זה אינו זמין מכיוון שהאפשרויות שלך שונות מאשר של בעל המשאב.
אפשרויות חזרה
השלם את המשפט
היא תבנית פתוחה. זה לא יוצר ציונים עבור לוח התוצאות.
נדרשת כניסה
סגנון חזותי
גופנים
נדרש מנוי
אפשרויות
החלף תבנית
הצג הכל
תבניות נוספות יופיעו במהלך המשחק.
תוצאות פתוחות
העתק קישור
קוד QR
מחיקה
האם לשחזר את הנתונים שנשמרו באופן אוטומטי:
?