basic.%read.apdos

C Function/BASIC Program, Releases: AP/DOS

Reads from an MS-DOS file.

Syntax

n=%read( file.handle, buffer, record.size)

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'.

See Also

Command Name Type Description
basic.cfunction Definition Declare a list of C functions.
basic.cfunc Definition can be called from a Pick/BASIC program or subroutine in AP/DOS and AP/Unix implementations using a syntax similar to that of normal C.
basic.system Function Displays status of system-controlled variables.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.