Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

can I check if dos file exists

67 views
Skip to first unread message

G.M.H.M. Heijnen

unread,
Apr 6, 1998, 3:00:00 AM4/6/98
to

Can I somehow check if a dos file exist (something like: IF
EXISTS('C:\MYFILE.DAT') THEN ...

I fount the FILEEXISTS command in the programmers manual, but it is
intended to use with the templates, not in 'normal' clarion programming.

I'm using CW2.003

Thanks in advance,
Geert Heijnen
gh...@dds.nl
gh...@superconfex.com

Marius Luidens

unread,
Apr 6, 1998, 3:00:00 AM4/6/98
to G.M.H.M. Heijnen

Hello Geert,
You could write your own FileExists Function.
HTH
Groetjes,
Marius Luidens

FileExists Function(sav:filename) !sav:filename is a string

DosFile FILE,DRIVER('DOS'),NAME(SAV:FILENAME)
record RECORD
END
END
code
Open(DosFile)
If errorcode = 2 ! File not Found
RETURN(0)
ELSE
CLOSE(DosFile)
RETURN(1)
END

Jim Katz

unread,
Apr 6, 1998, 3:00:00 AM4/6/98
to

Hi Geert,
Why not just use the Clarion Open file command. It doesn't even have to be a
Clarion dat file, just declare the file as a DOS file and try to open it,
then check for errorcodes.

HTH

G.M.H.M. Heijnen wrote:

> Can I somehow check if a dos file exist (something like: IF
> EXISTS('C:\MYFILE.DAT') THEN ...
>
> I fount the FILEEXISTS command in the programmers manual, but it is
> intended to use with the templates, not in 'normal' clarion programming.
>
> I'm using CW2.003
>
> Thanks in advance,
> Geert Heijnen
> gh...@dds.nl
> gh...@superconfex.com

--
Jim Katz
CTO iTradeZone,Inc.
http://www.iag.net/~jimkatz/
ICQ 9891427
Using Clarion for Windows
Always looking for the simpler solution.

Patrick De Laet

unread,
Apr 6, 1998, 3:00:00 AM4/6/98
to

This is a sample function to check if a file exists.
The file to check is passed as a parameter.

IF CheckFile('C:\CONFIG.SYS') = 0 THEN ...


CheckFile FUNCTION (DataSet) ! Declare Procedure
Files QUEUE,PRE()
Name STRING(13)
Date LONG
Time LONG
Size LONG
Attribute BYTE
END
LP LONG
NumRec LONG
CODE ! Begin processed code

DIRECTORY(Files, DataSet, ff_:DIRECTORY)
IF RECORDS(Files) = 0
RETURN(False)
ELSE
RETURN(True)
END

G.M.H.M. Heijnen wrote in message <01bd615c$57d1e1a0$095612c3@pcghnn>...

0 new messages