previous next top contents index framed top this page unframed
$ioSize(f,x), where x is a MAINSAIL data type code, returns the size of x based on the format of the data in f. For example, if f contains host data, $ioSize(f,x) returns the same value as size(x), but if f contains PDF data, $ioSize(f,x) returns the same value as pdfChars(x) (see the description of PDFMOD in Chapter 27 of the MAINSAIL Utilities User's Guide).
$ioSize returns 0 if f is a text file since there is no fixed size for the STRING representation of a data type.
The result of $ioSize is undefined if the type code is not that for BOOLEAN, (LONG) INTEGER, (LONG) REAL, or (LONG) BITS, or one of the explicitly sized variants of these types. If typ represents an explicitly sized type, $ioSize returns the size associated with typ's base type, since this is the size of the datum that is written to the file by write. For example, $ioSize(f,$integer1Code) returns the same value as $ioSize(integerCode), since write(f,i) writes the same number of bytes regardless of whether i is declared as INTEGER(1) or INTEGER(-1).
MAINSAIL Language Manual, Section 38.15