Data are used in all the programs for retrieving information. In QBASIC you can store data in a separate file called a data file. Hence there are two types of files in data processing. They are:
It is a process to create data file,write data to the data file and read data from it.
Types of File Handling
Files: This command is used to display all the files of current drive. Syntax: Files [File specification]
Shell: This command is used to go to DOS prompt temporarily.
NAME: This command is used to change the old file into new file. Syntax: Name " old file name" AS "New file name"
Kill: This command is used to remove the file from the disk. Syntax: Kill [ File Specification ]
MKDIR: This command is used to create a directory in a specific disk Syntax: MKDIR "path"
CHDIR: This command is used to change the directory. Syntax: CHDIR " path"
RMDIR: This command is used to remove the specific directory. Syntax: RMDIR "path"
System: This command is used to close the Q-BASIC program.
OPEN: This statement is used to open the file.
WRITE#: This statement is used to place the data into data file.
NPUT#: This statement is used to read each data and stores to corresponding variable.
LINE INPUT#: This statement reads entire line having maximum 255 characters and stores to a single string variable.
EOF ( ) : This statement is used to end a file. Syntax: EOF ( File number)
You need to open a sequential access data file in order to use it. A sequential data file can be opened in one of three modes.
Types of Mode:
A file that contains a set of instructions that are needed for data processing is known as program and file that contains only data required during data processing is known as data file.
A sequential access data file is a file that should be accessed in a sequential manner starting at the beginning of the data block and process ending in order until and end of data.