READTX Statement

The READTX statement reads the next record (block) on the magnetic tape or floppy disk unit in hexadecimal format, assigning its value to the specified variable.

Format

READTX var [RETURNING var]

[THEN

   statements

END] [ELSE

   statements

END]

Description

The READTX statement may be used to read a record from an attached magnetic tape or floppy disk unit, converting each character into its ASCII hexadecimal equivalent. See READT Statement for more information on the syntax for READTX.

By converting to hexadecimal, tapes or floppy disks containing segment marks (CHAR(255)) may be read by mvBASIC. READTX is most useful for reading tapes or floppy disks which were not written on a Mentor-based system and are therefore not in Mentor format.

After reading a tape or floppy disk in hexadecimal format via READTX, the ICONV function may be used with conversion code MX to convert the text back to readable text. To read a tape or floppy disk in its natural format, use the READT statement. See READT Statement for more information, and see Appendix B: List Of ASCII Codes for a list of ASCII codes.

Example

In this application, the READTX statement reads the data off the tape or floppy disk in hexadecimal format, and the ICONV function is used to convert the data back into ASCII characters.

READTX RECORD ELSE

   PRINT "SYSTEM ERROR --"   

END

RECORD = ICONV(RECORD,"MX")

See Also

Statement and Function Reference