HTBasic Help
×
Menu
Index

ENTER/OUTPUT from/to Strings

 
ENTER from strings starts at the beginning of the string with each ENTER statement, reads the data from the string with FORMAT ON, and returns an EOI signal with the last character of the string.
 
10 A$="12"&CHR$(10)&"34"
20 ENTER A$;B$
30 ENTER A$;C$
40 PRINT B$,C$
 
In this program, both B$ and C$ will have the value "12", even though the first ENTER did not read all the data from the string. With strings, each ENTER re-starts from the beginning of the string.
 
ENTER from a string with the "W" image specifier reads binary data from a string. The data is always read using the native byte ordering of the computer system, as explained previously in the "OUTPUT to Strings" section.
 
OUTPUT to strings starts at the beginning of the string with each OUTPUT statement, outputs the data into the string in FORMAT ON format, and then sets the string length. A second OUTPUT statement will overwrite the information from the first.
 
OUTPUT A$;"1"
OUTPUT A$;"2"
PRINT A$="2"&CHR$(13)&CHR$(10)
 
This program shows that the second output overwrites the data from the first. It also illustrates that the normal item and line terminators are output to the string unless suppressed.
OUTPUT to a string with the "W" image specifier writes binary data to a string. The data is always written using the native byte ordering of the computer system. Intel processors use LSB FIRST ordering. Motorola 68xxx and HP PA-RISC processors use MSB FIRST ordering.