Important: The information in this document is obsolete and should not be used for new development.
PBRead
You can use thePBReadfunction to read any number of bytes from an open file.
FUNCTION PBRead (paramBlock: ParmBlkPtr; async: Boolean): OSErr;
paramBlock- A pointer to a basic File Manager parameter block.
async- A Boolean value that specifies asynchronous (
TRUE) or synchronous (FALSE) execution.
--> ioCompletionProcPtrA pointer to a completion routine. <-- ioResultOSErrThe result code of the function. --> ioRefNumIntegerA file reference number. --> ioBufferPtrA pointer to a data buffer. --> ioReqCountLongIntThe number of bytes requested. <-- ioActCountLongIntThe number of bytes actually read. --> ioPosModeIntegerThe positioning mode. <-> ioPosOffsetLongIntThe positioning offset. DESCRIPTION
ThePBReadfunction attempts to readioReqCountbytes from the open file whose access path is specified in theioRefNumfield and transfer them to the data buffer pointed to by theioBufferfield. The position of the mark is specified byioPosModeandioPosOffset. If your application tries to read past the logical end-of-file,PBReadreads the data, moves the mark to the end-of-file, and returnseofErras its function result. Otherwise,PBReadmoves the file mark to the byte following the last byte read and returnsnoErr. After the read is completed, the mark is returned inioPosOffset, and the number of bytes actually read into the buffer is returned inioActCount.You can specify that
PBReadread the file data 1 byte at a time until the requested number of bytes have been read or until the end-of-file is reached. To do so, set bit 7 of theioPosModefield. Similarly, you can specify thatPBReadshould stop reading data when it reaches an application-defined newline character. To do so, place the ASCII code of that character into the high-order byte of theioPosModefield; you must also set bit 7 of that field to enable newline mode.
- Note
- When reading data in newline mode,
PBReadreturns the newline character as part of the data read and setsioActCountto the actual number of bytes placed into the buffer (which includes the newline character).
ASSEMBLY-LANGUAGE INFORMATION
The trap macro forPBReadis_Read.RESULT CODES
 
  
  
 