A further point of clarification ( one year later).
The help says: [quote:945071a1ac]The first function call needs a file mask. All other calls do not need the file mask. In fact when you want to get the next filename from the directory, you must not provide a mask after the first call.
[/quote:945071a1ac]
Obviously [i:945071a1ac]"you must not provide a mask after the first call"[/i:945071a1ac] must terminate at some stage. Is this true until the next SDinit or until the next chdir? In other words, after a dir(*.*), subsequently dir() will return the next file each time until all done. However if I change directories, do i do dir(*.*) or just dir() to get the next filename? The reason i ask this seemingly trivial question is that I have a loop like this:
[code:1:945071a1ac]
do
chdir""
chdir somefilename
myfilename = dir(*.*) ' get the first file
dosomething
dosomething
dosomething
myfilename = dir(_) 'get the next file
if myfilename="" then exit do
loop[/code:1:945071a1ac]
This code works fine, BUT if in the line "dosomething" I call another sub which involves some file handling, the dir() that follows gives unexpected results.
↧