Specifications
Saturn Debug Stub Functions 10-7
Psy-Q Development System
The PCread Function
Description
This function reads a specified number of bytes from a file on the host machine.
Prototype
int
PCread
(int fd, char *buff, int len)
passed: file-handle
buffer address
count
return: count of number of bytes actually read
Remarks
Unlike the assembler function this returns a full 32 bit count.
PCread should not be passed extreme values of count, as could be achieved on a
UNIX system, as this will cause the
full amount
specified to be transferred i.e.
not
just to the end of the file.
To find the length of a file and read it into memory, perform:
Len = PClseek( fd, 0,2);
PClseek( fd, 0,0);
Num = PCread( fd, buff, Len);
Note:
You must PClseek back to the beginning of the file before you try to read
from it.