Reading and Writing Tapes or Floppy Disks

mvBASIC includes several statements for tape and floppy disk processing. For the purpose of this discussion a floppy disk functions as a tape and therefore, is included in any reference to a tape. For reading and writing strings on tape, there are the READT and WRITET statements. As expected, the READT statement reads the next record off the attached tape device, and the WRITET statement writes a record onto the tape. The READTX statement is designed for tapes which might contain segment marks. The READTX statement is identical to the READT statement, except that the data from the tape is translated into ASCII hexadecimal format before it is assigned to the string. The ICONV function can then be used to translate the string back into readable format. READTX is designed for reading segment marks (CHAR(255)) from a tape.

In addition, there are statements to simulate the T-WEOF and T-REW commands. The WEOF statement writes an End-Of-File mark at the current position of the tape, and the REWIND statement rewinds the tape to the beginning.

Each of the tape I/O statements includes THEN and ELSE clauses to specify action according to whether the tape statement was successful. The ELS clause is often used to produce a meaningful error message by calling the SYSTEM(0) function. The SYSTEM(0) function returns a number from 0 to 4, reflecting whether the latest tape I/O statement worked, and if it didn’t, what the problem was. See Statement and Function Reference for more information.

See Also

Overview of mvBASIC Statements and Functions

Assignment Statements

Intrinsic Functions

Internal Program Control

External Program Control

Sending Output to the Screen and Printer

Terminal Input

Dynamic Array Processing

Generalized String Processing

Dimensioned Arrays

Reading and Updating File Items

Communications

Execution Locks

Compiler Directives

Miscellaneous Statements and Functions

The Error Message Processor