basic.%read.apdos C Function/BASIC Program


Command basic.%read.apdos C Function/BASIC Program
Applicable release versions: AP/DOS
Category BASIC Program (486)
Description reads the number of bytes designated by "record.size" into "buffer" from a file specified by "file.handle", where "file.handle" has been returned by a previous call to "%open()".

"buffer" must be allocated at least the "record.size" number of bytes before the call to "%read" is made otherwise the data will be truncated. This can be done by using an explicit assignment ( buffer = space(1000) ) or by using the "char" reserve statement. The function returns the number of bytes read. If less than record.size bytes are read, the contents of the buffer beyond what was read is undefined. If the data read into buffer contains Segment Marks (hexadecimal FF), results are unpredictable. For additional information refer to the MS-C library reference manual under READ().

If any errors are encountered during a C function, the function "system(0)" returns the "errnum".
Syntax n=%read( file.handle, buffer, record.size)
Related basic.cfunction