Readstring – AMT Datasouth PAL User Manual
Page 161

155
readstring
readstring
Description
Read data from an open file.
Usage
OpenFile AnyStr
readstring
ReadStr GoodBool
OpenFile
File. A file object returned by the file operator. The programmer must have
opened the file for reading.
AnyStr
String. A string which establishes the number of bytes to read from the specified
file. The data contained within the string does not matter. PAL only uses the
length of the string to determine the number of bytes to read.
ReadStr
String. Data read from file. The length of the string will depend upon the number
of bytes available from the file. The string will not exceed the length of AnyStr.
GoodBool
Boolean. true if read was successful. false if no data available due to end of file.
Comments
PAL only uses the length of AnyStr to determine the number of bytes to read from the specified
file. PAL ignores any data contained in AnyStr.
PAL will return a string which does not exceed the length of AnyStr. If the file does not have
sufficient data immediately available, readstring will only return the immediately available data.
readstring does not block waiting for the requested amount of data to become available.
PAL generally considers as immediately available all data contained in files on some form of
storage device. Typically only files associated with some form of input device will not have data
available immediately.
If PAL returns GoodBool as false, it indicates that PAL reached the end of the file without
recovering any data. PAL will return true even if PAL encounters the end of file after reading part
of the requested data. The file must have no data remaining for PAL to return in order for PAL to
return GoodBool as false.
PAL will typically not return an GoodBool value of false for file associated with most input
devices. For most input devices, PAL assumes that new data may arrive via the device at a future
time.