[forther] checking file and folder existence
rt4all at hetnet.nl
rt4all at hetnet.nl
Wed Jun 10 02:18:05 PDT 2020
Thanks Marcel, just cross post.
Should have done what you suggested of course.
I went into i4thhelp.htm and followed the '1000' references to FILE.
-r
> On 10 Jun 2020, at 10:55, mhx at iae.nl wrote:
>
> On 2020-06-10 08:45, rt4all at hetnet.nl wrote:
>> Hi all,
>> Are there iForth versions for
>> SwiftForth IS-DIR ( z-addr -- flag ) and IS-FILE ( z-addr -- flag )
>> or VFX dirExists? \ caddr len -- flag and FileExist? \ caddr
>> len -- flag
>> I need to check the existence of nib files just prior to an attempt showing them
>> on the screen in macOS coco-i4 SHOW.NIB
>
> FORTH> words: file
> LIST-OPEN-FILES ?FILE$ ?FILE CURRENT-FILE: SLURP-FILE(3) SLURP-FILE(2) SLURP-FILE(1) SLURP-FILE
> FILE-BIRTH FILE-TIME FILE-EXISTS? FILE-HERE ONLY-BASEFILENAME ONLY-FILENAME CURRENT-FILE= FILE-I//O
> INCLUDE-FILE FILE-SIZE FILE-POSITION REPOSITION-FILE RESIZE-FILE FLUSH-FILE WRITE-FILE READ-FILE
> SEEK-FILE CLOSE-FILE OPEN-FILE FILE-STATUS RENAME-FILE DELETE-FILE CREATE-FILE MAP-FILE
> SOURCEFILENAME ?FILE logfile
> ok
> FORTH> help file-status
> FILE-STATUS FILE EXT
> ( c-addr u -- x ior )
> Return the status of the file/directory identified by the character
> string (c-addr u). The ior is zero if the file/directory exists and
> writing to it is possible; otherwise <ior> is TRUE.
> x contains implementation-defined information about the file.
> In iForth x is a bitmask giving more details,
> $0001 - set when a regular file was tested.
> $0002 - set when a directory was tested
> $0100 - set when reading from file/directory is possible
> $0200 - set when writing to file/directory is possible
> All other bits are reserved and cleared.
> ok
> FORTH>
>
> -marcel
> _______________________________________________
> forther mailing list
> forther at lists.iforth.org
> http://lists.iforth.org/listinfo.cgi/forther-iforth.org
More information about the forther
mailing list