Important: The information in this document is obsolete and should not be used for new development.
FSRead
You can use theFSReadfunction to read any number of bytes from an open file.
FUNCTION FSRead (refNum: Integer; VAR count: LongInt; buffPtr: Ptr): OSErr;
refNum- The file reference number of an open file.
count- On input, the number of bytes to read; on output, the number of bytes actually read.
buffPtr- A pointer to the data buffer into which the bytes are to be read.
DESCRIPTION
TheFSReadfunction attempts to read the requested number of bytes from the specified file into the specified buffer. ThebuffPtrparameter points to that buffer; this buffer is allocated by your application and must be at least as large as thecountparameter.Because the read operation begins at the current mark, you might want to set the mark first by calling the
SetFPosfunction. If you try to read past the logical end-of-file,FSReadreads in all the data up to the end-of-file, moves the mark to the end-of-file, and returnseofErras its function result. Otherwise,FSReadmoves the file mark to the byte following the last byte read and returnsnoErr.
- Note
- The low-level
PBReadfunction lets you set the mark without having to callSetFPos. Also, if you want to read data in newline mode, you must usePBReadinstead ofFSRead.![]()
RESULT CODES