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 코드
삭제
자동 저장된
게임을 복구할까요?