PFE 0.33.71 Homepage SourceForge Download Documentation -Overview -The PFE Manual old manual / (book) -ChangeLog -Authors -License (LGPL) -Wordsets / (book) -Functions .. (book) -Dp of ANS Forth -The 4thTutor -Forthprimer.pdf - Old Wordsets - Old Words List Forth Links * Forth Repository * Taygeta Compilation * TinyBoot FirmWare * FiCL, Free Forth * Research Vienna * Research Bournemouth * zForth WebRing Other Links * Tektronix/MPT * Forth Org. (FIG) * Forth Inc. * MPE Ltd. Forths * SF Win32Forth * PD Win32Forth * Neil Bawd generated (C) Guido U. Draheim guidod@gmx.de | ## File-access + extensions `BIN``( access-mode# -- access-mode#' )``[ANS]` => `"[ANS] FORTH"` modify the give file access-mode to be a binary-mode primitive code = [p4_bin] `CLOSE-FILE``( some-file* -- some-errno# )``[ANS]` => `"[ANS] FORTH"` close the file and return the status-code primitive code = [p4_close_file] `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. primitive code = [p4_create_file] `DELETE-FILE``( name-ptr name-len -- name-errno# )``[ANS]` => `"[ANS] FORTH"` delete the named file and return a status code primitive code = [p4_delete_file] `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. primitive code = [p4_file_position] `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. primitive code = [p4_file_size] `INCLUDE-FILE``( some-file* -- )``[ANS]` => `"[ANS] FORTH"` `INTERPRET` the given file primitive code = [p4_include_file] `INCLUDED``( name-ptr name-len -- )``[ANS]` => `"[ANS] FORTH"` open the named file and then `INCLUDE-FILE` see also the interactive `INCLUDE` primitive code = [p4_included] `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. primitive code = [p4_open_file] `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. primitive code = [p4_read_file] `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` primitive code = [p4_read_line] `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. primitive code = [p4_reposition_file] `RESIZE-FILE``( s,size# some-file* -- some-errno# )``[ANS]` => `"[ANS] FORTH"` resize the give file, returns a status code where zero means success. primitive code = [p4_resize_file] `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. primitive code = [p4_write_file] `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. primitive code = [p4_write_line] `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. primitive code = [p4_file_status] `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. primitive code = [p4_flush_file] `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. primitive code = [p4_rename_file]