Intermec PM23c Fingerprint Developer's Guide (PC23d, PC43d/t, PM23c, PM43, PM4 - Page 58
Reading a Specific Data Length With INPUT$, Reading a Line to a Variable With LINE INPUT
View all Intermec PM23c manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 58 highlights
Chapter 4 - Managing Input and Output Reading a Specific Data Length With INPUT$ INPUT$ reads a specified number of characters from the specified sequential file or channel. By default, if no file or channel is specified, the data on the standard IN channel is read. The execution is held up waiting for the specified number of characters to be received. If a file does not contain as many characters as specified in the INPUT$ statement, the execution resumes as soon as all available characters in the file have been received. Sequential files are read from the start and once a number of characters has been read, they cannot be read again until the file is closed and opened again. Subsequent INPUT$ statements start with the first of the remaining available characters. Example (reads portions of characters from a file OPENed as #1): 10 OPEN "QFILE" FOR OUTPUT AS #1 20 PRINT #1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 30 CLOSE #1 40 OPEN "QFILE" FOR INPUT AS #1 50 A$=INPUT$(10,1) 60 B$=INPUT$(5,1) 70 C$=INPUT$(100,1) 80 PRINT "Record 1:",A$ 90 PRINT "Record 2:",B$ 100 PRINT "Record 3:",C$ 110 CLOSE #1 RUN The printer returns: Record1: ABCDEFGHIJ Record2: KLMNO Record3: PQRTSUVWXYZ Reading a Line to a Variable With LINE INPUT# This command reads an entire line (including all punctuation) to a string variable. Commas inside a string are treated as punctuation marks and do not divide the string into records. This example reads a complete line in a file and places the data in a "single-string" variable): 10 OPEN "QFILE" FOR OUTPUT AS #1 20 PRINT #1, "Record A,Record B,Record C" 30 CLOSE #1 40 OPEN "QFILE" FOR INPUT AS #1 50 LINE INPUT #1, A$ 60 PRINT A$ 70 CLOSE #1 RUN The printer returns: Record A,Record B,Record C 46 Fingerprint Developer's Guide