This group of words provides the ANS file word set using the native file system facilities.
These are ignored at present, but are provided for compatibility.
: bin \ fam -- 'fam
Modify a file-access method to include BINARY.
1 constant r/o \ -- fam
Specifiy a read-only file.
2 constant w/o \ -- fam
Get Writeonly fam.
3 constant r/w \ -- fam
Get ReadWrite fam.
: FSerr: \ err# -- ; n -- 0|err#
The underlying file system primitives return zero on error.
The children of this word return 0 on success or a given
error code which can in turn be used as a throw code.
#-258 FSerr: ?err_open \ n -- n' #-412 FSerr: ?err_create \ n -- n' #-414 FSerr: ?err_read \ n -- n' #-415 FSerr: ?err_write \ n -- n' #-416 FSerr: ?err_close \ n -- n' #-417 FSerr: ?err_seek \ n -- n' #-418 FSerr: ?err_delete \ n -- n' #-419 equ err_handle \ -- n #-420 equ err_resize \ -- n
: Open-File \ c-addr u fam -- fileid ior
Create a file on disk, returning a 0 ior for success and
a file id.
: Create-File \ c-addr u fam -- fileid ior
Create a file on disk, returning a 0 ior for success and
a file id.
: delete-file \ c-addr u -- ior
Delete a named file from disk, and return ior=0 on success.
: Read-File \ caddr u fileid -- u2 ior
Read data from a file. The number of bytes actually read is
returned as u2, and ior is returned 0 for a successful read.
Note that all reads with zero length succeed.
: Write-File \ caddr u fileid -- ior
Write a block of memory to a file. Note that all writes
with zero length succeed.
: Close-File \ fileid -- ior
Close an open file.
: file-position \ fileid -- ud ior
Return file position, and return ior=0 on success.
: Reposition-File \ ud fileid -- ior
Set file position, and return ior=0 on success.
: file-size \ fileid -- ud ior
Get size in bytes of an open file as a double number,
and return ior=0 on success.
: Resize-File \ ud fileid -- ior
Set the size of the file to ud, an unsigned double number. After
using RESIZE-FILE, the result returned by FILE-POSITION may
be invalid.