home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
euphoria
/
getnames.e
< prev
next >
Wrap
Text File
|
1994-02-19
|
891b
|
43 lines
-- get file names from dir command
-- or user's typed input
function no_blanks(sequence x)
-- squeeze out all blanks in a string
sequence nbx
nbx = ""
for i = 1 to length(x) do
if x[i] != ' ' then
nbx = nbx & x[i]
end if
end for
return nbx
end function
global function get_names()
-- convert the output from a plain dir command into a
-- sequence of file names
sequence file_names
object name
file_names = {}
while 1 do
name = gets(0)
if atom(name) then
exit
end if
if length(name) >= 12 then
if name[1] >= 'A' and name[1] <= 'Z' then
if not match("DIR", name[9..length(name)]) then
name = name[1..12]
name[9] = '.'
file_names = append(file_names, no_blanks(name))
end if
end if
end if
end while
return file_names
end function