Difference between revisions of "Bfile ReadFile OS"

From WikiPrizm
Jump to navigationJump to search
(Commented on the size and pos.)
m (Category)
Line 4: Line 4:
 
| signature = int Bfile_ReadFile_OS(int handle, void *buf, int size, int pos)
 
| signature = int Bfile_ReadFile_OS(int handle, void *buf, int size, int pos)
 
| synopsis = Reads bytes from an open file.
 
| synopsis = Reads bytes from an open file.
 +
| header = fxcg/file.h
 
| parameters =
 
| parameters =
 
* '''handle''': File handle as returned by [[Bfile_OpenFile_OS]].
 
* '''handle''': File handle as returned by [[Bfile_OpenFile_OS]].
Line 14: Line 15:
 
If '''size''' is >0, then the position in the file handle will be moved to '''pos'''+'''size''' after the function.  If '''size''' is 0, the position will not be set to '''pos'''.
 
If '''size''' is >0, then the position in the file handle will be moved to '''pos'''+'''size''' after the function.  If '''size''' is 0, the position will not be set to '''pos'''.
 
}}
 
}}
 +
 +
[[Category:Syscalls:Bfile]]

Revision as of 20:09, 31 July 2012


Synopsis

Header: fxcg/file.h
Syscall index: 0x1DAC
Function signature: int Bfile_ReadFile_OS(int handle, void *buf, int size, int pos)

Reads bytes from an open file.

Parameters

  • handle: File handle as returned by Bfile_OpenFile_OS.
  • buf: Location to store data read from file.
  • size: Number of bytes to read.
  • pos: File offset to read at, or -1 to read from the current file pointer (like stdio).

Returns

Number of bytes read, or a negative error code on failure.

Comments

Large values for size (one megabyte or more) may cause issues (hang the calculator).

If size is >0, then the position in the file handle will be moved to pos+size after the function. If size is 0, the position will not be set to pos.