MAINSAIL Language Manual, Section 35.11

previous   next   top   complete contents   complete index   framed top   this page unframed


35.11. fldRead

Figure 35–11. fldRead (GENERIC)
STRING
PROCEDURE   fldRead     (POINTER(textFilef;
                         
INTEGER width;
                         
OPTIONAL POINTER($areaarea);

STRING
PROCEDURE   fldRead     (POINTER(dataFilef;
                         
INTEGER width;
                         
OPTIONAL POINTER($areaarea);

STRING
PROCEDURE   fldRead     (MODIFIES STRING s;
                         
INTEGER width);

fldRead reads a field (a STRING consisting of the next width characters) from an input file or a STRING.

If width is less than one, "" is returned.

If requested characters lie beyond the end of the file or STRING, only those characters (if any) obtained before the end of the file or STRING are returned.

The textFile form may be called for an unbuffered file (a file opened with the $unbuffered bit set). fldRead does not filter out null or carriage return characters from an unbuffered file; i.e., it acts as if the file had been opened with the keepNul bit set. If the file is opened for PDF I/O, the characters may be translated from the PDF to the host character set.

For example, s := fldRead(inFile,15) reads the next 15 characters from inFile. If only 10 characters remain in the file, then the STRING consisting of those 10 characters is returned.

In the textFile and dataFile forms, area specifies the destination area for the resulting STRING if new STRING text is generated; see Section 29.4.

Characters in a data file are stored as described in Sections 32.66 and 32.97.


previous   next   top   complete contents   complete index   framed top   this page unframed

MAINSAIL Language Manual, Section 35.11