h6. [[OS SWI Calls]] h6(. » [[OS_File]] h6((. » OS_File 16 h2. OS_File 16 h5. (SWI &08) |_<^{width:3em}. Entry | | |<^. R0 |<^. 16 (reason code) | |<^. R1 |<^. Pointer to filename | |<^. R2 |<^. Load address if (R3 AND &FF = 0) | |/3<^. R3 |<^. Bits 0-7 clear to use R2 as load address, else use file's load address/filetype | |<^. Bit 30 is used by the SaferOSFile extension | |<^. Bit 31 set to specify the file is code and should be [[OS_SynchroniseCodeAreas|synchronised]] | |<^. R5 |<^. Length of buffer at R2 (if R3b30 set and SaferOSFile extension present) | |_<^{width:3em}. Exit | | |<^. R0 |<^. [[File Object Types|Object type]] | |<^. R1 |<^. Preserved | |<^. R2 |<^. "Load address":linkload | |<^. R3 |<^. "Execution address":linkexecution | |<^. R4 |<^. Object length | |<^. R5 |<^. "Object attributes":linkattributes | h4. Use The purpose of this call is to load a named file, using no path. h4. Notes An error will be generated if the file is not found, is a directory, no read access, or a bad load address. If the file is stamped, and loading at load address (R3 AND &FF <> 0) the variable <code>Alias$@LoadType_xxx</code> will be used, and it is possible that (like [[OS_FSControl 4]]) this call may not return. There are several different reason codes that can be used to load files using the [[OS_File]] call. They differ depending on how the path used to find the file. In addition: * R3 bit 31 is not supported (or necessary) before RISC OS 3.70. * As of RISC OS 3.71, files stamped &F95 (Code) are always Syncrhonised after loading. h4. See also * "Execution address":linkexecution * "Load address":linkload * "Object attributes":linkattributes * [[File Object Types|Object type]] * [[OS_File]] * [[OS_File 12]] * [[OS_File 14]] * [[OS_File 255]] * [[OS_FSControl 4]] [linkload]FileSwitch%20Key%20Features#load_execution [linkexecution]FileSwitch%20Key%20Features#load_execution [linkattributes]FileSwitch%20Key%20Features#file_attributes