QBASIC is an Integrated Development Environment (or IDE) and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was also a short-lived version for the classic Mac OS. It is loosely based on GW-BASIC but adds user-defined types, improved programming structures, better graphics and disk support and a compiler in addition to the interpreter.

File Handling in QBASIC

01. What is a program file?

Ans: A file that has a set of instructions and can perform a task when it is executed is known as a program file.

02. What is a data file?

Ans: Data file is the collection of related data stored in memory.

03. What are the different modes of file handling?

Ans: The different file modes are listed below:

OUTPUT mode: To create a new data file and write data in it.

INPUT mode: To retrieve read the contents of the existing data file.

APPEND mode: To add more records to the existing file.

04. Functions and statements used in file handling:

INPUT statement: It is used to read the data of a sequential file and stores them in variable

LINE INPUT- statement: It reads an entire line from a sequential file and assign to a string variable.

EOF () Function: This function is used to check the end of file.

INPUT $ Function: It is used to return a part of a string from a file.

FILES statement: This statement displays a list of files of a disk or a directory.

KILL statement: This statement is used to delete files.

NAME statement: This statement renames a file.

CHDIR statement: This statement changes a drive’s default directory.

MKDIR statement: This statement creates a new directory or subdirectory

RMDIR statement: This statement removes a subdirectory (folder)

SHELL Command: This command is used to exit temporarily from the QBASIC environment to DOS prompt.

SYSTEM command: This command closes all the files and exits permanently from the QBASIC