Re: Find an file in an directory

From: Mike Ghan <mikeghan_at_logix-controls.com>
Date: Tue, 4 Dec 2001 07:40:57 -0800

The command FILE-EXISTS ( caddr u -- flag ) is supplied with
SwiftForth and should meet your needs. It can be defined simply using
ANS Forth as

: FILE-EXISTS ( caddr u -- flag ) FILE-STATUS NIP 0= ;

The ANS Forth Draft Proposal is available at
http://www.forth.org/literature.html
and is a valuable reference when working with SwiftForth.

Mike

----- Original Message -----
From: "Schmitt Louis Jean-Pierre" <louis.schmitt_at_eif.ch>
To: <sftalk_at_forth.com>
Sent: Tuesday, December 04, 2001 2:28 AM
Subject: [sftalk] Find an file in an directory

Y have devoleped with TF83 runing under DOS the fonction FILEXIST
Y would have it for running with SwiftForth.
Can you help my please for create an fonction to find an file in an=
 directory

My old Fonction

: FILE%EXIST ( adr, len --- fl ) \ Teste si un fichier existe. Le
nom dos
                \ du fichier est point=E9 par adr et len.
                \ Le nom du fichier peut contenir des jokers.
=
 =1F

  128 SET-DMA \ Valeur habituelle DTA dans PSP
  dma 30 + 12 blank
  OVER 1+ C@ ASCII : =3D
  IF
    OVER C@ UPC ASCII A - SELECT
  THEN
  PAD PLACE 0 PAD COUNT + C!
  PAD 1+ 18 (SEARCH0)

;

The new fonction in SwiftForth

: FILE%EXIST ( addr,len --- flag ) \ Return an true flag if the file
pointed
\ with addr,len exist. If the file not exist then flag is false

????????????????
????????????????
????????????????

;

For Exemple, y will writen in my programm

S" C:\TFXDEV\WIN\Commandes Grafcet.Gft" FILE%EXIST

If the file C:\TFXDEV\WIN\Commandes Grafcet.Gft exist=20
Then Fonction FILE%EXIST will return TRUE
If the file not exist then FILE%EXIST will return FALSE

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Tue Dec 04 2001 - 07:40:14 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 07-Feb-2012. Archive updated nightly.