1. Dir() problem....
Hy,
(Happy new year.)
I have a problem with dir() (from file.e) .
If I want the index of files for example :
dir("*.exe")
It returns a sequence when there are files.
It returns -1 when there is no file with .exe .
So if I check for -1 at the return it works when
I have no files with .exe.
But if there is a file with .exe .
It gives an error message for the line I
check for -1.
Can someone help me ??
Bye,
PQ
QC
(quistnet at yahoo.com)
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
2. Re: Dir() problem....
- Posted by JJProg at CYBERBURY.NET
Jan 01, 1999
-
Last edited Jan 02, 1999
EU>Hy,
EU>(Happy new year.)
EU>I have a problem with dir() (from file.e) .
EU>If I want the index of files for example :
EU>dir("*.exe")
EU>It returns a sequence when there are files.
EU>It returns -1 when there is no file with .exe .
EU>So if I check for -1 at the return it works when
EU>I have no files with .exe.
EU>But if there is a file with .exe .
EU>It gives an error message for the line I
EU>check for -1.
EU>Can someone help me ??
EU>Bye,
EU>PQ
EU>QC
EU>(quistnet at yahoo.com)
EU>______________________________________________________
EU>Get Your Private, Free Email at http://www.hotmail.com
If you are using something like:
object x
x = dir("*.exe")
if x = -1 then
-- do something
end if
-- do something
You need to change it to one of the following:
if compare(x,-1) = 0 then
or
if integer(x) then
Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJProg/
3. Re: Dir() problem....
On Fri, 1 Jan 1999 16:19:51 PST, Patrick Quist <quistnet at HOTMAIL.COM> wrote:
>Hy,
>
>(Happy new year.)
>
>I have a problem with dir() (from file.e) .
>If I want the index of files for example :
>dir("*.exe")
>It returns a sequence when there are files.
>It returns -1 when there is no file with .exe .
object d -- gotta be an object, which can hold either sequence or atom (-1)
d = dir("C:\\MTDIR")
if atom(d) then puts(1,"Directory is empty")
else do_something_else()
end if
Irv
4. Dir() problem....
- Posted by Ad Rienks <Ad_Rienks at COMPUSERVE.COM>
Jan 02, 1999
-
Last edited Jan 03, 1999
Patrick wrote:
>Hy,
>(Happy new year.)
Happy new year too, to all Euphorians!
>I have a problem with dir() (from file.e) .
>If I want the index of files for example :
>dir("*.exe")
>It returns a sequence when there are files.
>It returns -1 when there is no file with .exe .
>So if I check for -1 at the return it works when
>I have no files with .exe.
>But if there is a file with .exe .
>It gives an error message for the line I
>check for -1.
>Can someone help me ??
>Bye,
>PQ
>QC
>(quistnet at yahoo.com)
---- example:
object Directory -- an object can hold an atom OR a sequence
Directory =3D dir("*.exe")
if atom(Directory) then
-- no sequence, so no exe files found
puts("Nothing found")
else
-- there is a sequence
-- rest of your routine
end if
---- end example ----
Ad Rienks
kwibus at dolfijn.nl