0 like 0 dislike
6 views
asked ago in Computer Science by (69.7k points)
Briefly describe the opening modes in BASIC?

1 Answer

0 like 0 dislike
answered ago by (69.7k points)
Opening a File: When creating a sequential file,the first thing the programmer must do is open the file using the open statement.The open statement has the following form:OPEN"file Name.ext"FOR mode AS#[buffer].The OPEN statement will provide the name of the file,the way in which it will be used ,and the buffer number of the file.The same rule apply for the naming data files as they do for naming "regular"BASIC program files,except a data file should normally be given an extension ).ext) of .DAT where as a program file is given an extension of .BAS.

WRTITING TO A FILE:Writting to a file that has been previously opened in OUTPUT mode is accomplished using the write # statement works much like the print statement,except instead of sending output to the screen,the WRITE # statement will send data to the opend file .Another difference is that when using the WRITE# statement, you must first indicate the buffer number of the file being written to .For example,consider the following WRITE# statement:

WRITE#1,name,address,phone READING FROM a File: Reading data from a file that has been previously opened as INPUT is accomplished using the INPUT# statement.The INPUT # statement is similar to the INPUT statement,except instead of reading user data input from the keyboard,the INPUT# statement reads data input from a file on disk .For example,consider the following: INPUT#1,stuName,gpa,grade
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute:

3.1k questions

2.6k answers

18 comments

2.7k users

...