Name

pfe-file-ext ? File-access + extensions

Synopsis

BIN ( access-mode# -- access-mode#' ) ?=>? ();?
"[ANS] FORTH";
?
CLOSE-FILE ( some-file* -- some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
CREATE-FILE ( name-ptr name-len open-mode# -- name-file* name-errno# ) ?=>? ();?
"[ANS] FORTH";
?
DELETE-FILE ( name-ptr name-len -- name-errno# ) ?=>? ();?
"[ANS] FORTH";
?
FILE-POSITION ( some-file* -- p,pos# some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
FILE-SIZE ( some-file* -- s,size# some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
INCLUDE-FILE ( some-file* -- ) ?=>? ();?
"[ANS] FORTH";
?
INCLUDED ( name-ptr name-len -- ) ?=>? ();?
"[ANS] FORTH";
?
OPEN-FILE ( name-ptr name-len open-mode# -- name-file* name-errno# ) ?=>? ();?
"[ANS] FORTH";
?
READ-FILE ( buf-ptr buf-len some-file* -- buf-count some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
READ-LINE ( buf-ptr buf-len some-file* -- buf-count buf-flag some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
REPOSITION-FILE ( o,offset# some-file* -- some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
RESIZE-FILE ( s,size# some-file* -- some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
WRITE-FILE ( buf-ptr buf-len some-file* -- some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
WRITE-LINE ( buf-ptr buf-len some-file* -- some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
FILE-STATUS ( file-ptr file-len -- file-subcode# file-errno# ) ?=>? ();?
"[ANS] FORTH";
?
FLUSH-FILE ( some-file* -- some-errno# ) ?=>? ();?
"[ANS] FORTH";
?
RENAME-FILE ( oldname-ptr oldname-len newname-ptr newname-len -- newname-errno# ) ?=>? ();?
"[ANS] FORTH";
?

Description

"ENVIRONMENT MAX-FILES" ( -- files-max ) [ENVIRONMENT] * the number of opened file-ids allowed during compilation. * portable programs can check this with => ENVIRONMENT?

BIN ( access-mode# -- access-mode#' ) [ANS] => "[ANS] FORTH"

modify the give file access-mode to be a binary-mode

CLOSE-FILE ( some-file* -- some-errno# ) [ANS] => "[ANS] FORTH"

close the file and return the status-code

CREATE-FILE ( name-ptr name-len open-mode# -- name-file* name-errno# ) [ANS] => "[ANS] FORTH"

create the file with the given name and open it - returns the file id and a status code. A code of zero means success. An existing file of the same name is truncated upon open.

DELETE-FILE ( name-ptr name-len -- name-errno# ) [ANS] => "[ANS] FORTH"

delete the named file and return a status code

FILE-POSITION ( some-file* -- p,pos# some-errno# ) [ANS] => "[ANS] FORTH"

return the current position in the file and return a status code. A code of zero means success.

FILE-SIZE ( some-file* -- s,size# some-errno# ) [ANS] => "[ANS] FORTH"

return the current size of the file and return a status code. A code of zero means success.

INCLUDE-FILE ( some-file* -- ) [ANS] => "[ANS] FORTH"

INTERPRET the given file

INCLUDED ( name-ptr name-len -- ) [ANS] => "[ANS] FORTH"

open the named file and then INCLUDE-FILE see also the interactive INCLUDE

OPEN-FILE ( name-ptr name-len open-mode# -- name-file* name-errno# ) [ANS] => "[ANS] FORTH"

open the named file with mode. returns the file id and a status code. A code of zero means success.

READ-FILE ( buf-ptr buf-len some-file* -- buf-count some-errno# ) [ANS] => "[ANS] FORTH"

fill the given string buffer with characters from the buffer. A status code of zero means success and the returned count gives the number of bytes actually read. If an error occurs the number of already transferred bytes is returned.

READ-LINE ( buf-ptr buf-len some-file* -- buf-count buf-flag some-errno# ) [ANS] => "[ANS] FORTH"

fill the given string buffer with one line from the file. A line termination character (or character sequence under WIN/DOS) may also be placed in the buffer but is not included in the final count. In other respects this function performs a READ-FILE

REPOSITION-FILE ( o,offset# some-file* -- some-errno# ) [ANS] => "[ANS] FORTH"

reposition the file offset - the next FILE-POSITION would return o.offset then. returns a status code where zero means success.

RESIZE-FILE ( s,size# some-file* -- some-errno# ) [ANS] => "[ANS] FORTH"

resize the give file, returns a status code where zero means success.

WRITE-FILE ( buf-ptr buf-len some-file* -- some-errno# ) [ANS] => "[ANS] FORTH"

write characters from the string buffer to a file, returns a status code where zero means success.

WRITE-LINE ( buf-ptr buf-len some-file* -- some-errno# ) [ANS] => "[ANS] FORTH"

write characters from the string buffer to a file, and add the line-terminator to the end of it. returns a status code.

FILE-STATUS ( file-ptr file-len -- file-subcode# file-errno# ) [ANS] => "[ANS] FORTH"

check the named file - if it exists the status errno code is zero. The status subcode is implementation-specific and usually matches the file access permission bits of the filesystem.

FLUSH-FILE ( some-file* -- some-errno# ) [ANS] => "[ANS] FORTH"

flush all unsaved buffers of the file to disk. A status code of zero means success.

RENAME-FILE ( oldname-ptr oldname-len newname-ptr newname-len -- newname-errno# ) [ANS] => "[ANS] FORTH"

rename the file named by "oldname" to the name of "newname" returns a status-code where zero means success.