HTBasic Help
×
Menu
Index

ASSIGN Statement

 
ASSIGN is similar to OPEN in other computer languages. ASSIGN makes a connection to an instrument, screen, keyboard, printer, file, interface, buffer, or other device. All the information concerning this connection is saved by the ASSIGN statement in an I/O path object variable. The I/O path variable name is subject to the same naming rules as other HTBasic variables. However, as an object variable, it can hold a number of attributes in addition to the Isc or device address that are specified in the ASSIGN statement. These settings affect how the I/O operation is done. So, depending on the type of I/O being performed, a simple numeric variable or expression may suffice, or you may need an I/O path variable witch can hold additional settings. The syntax to distinguish between a simple numeric variable containing only a device number and an object I/O path variable with additional settings, is to place "@" in front of an I/O path variable name.
 
After the initial ASSIGN, subsequent ASSIGN statements can be used to redirect the I/O, change the attributes, or close the file or connection. Several I/O paths can be set up simultaneously. In fact, any number of I/O path variables may exist in your program.