Page 1 of 1

File Searching

Posted: Fri Mar 12, 2004 12:17 pm
by The Real KrazyK
Hi,
When I used GFA on the AtariST there were commands to find the first and next occurrence of a specified file/folder name.
Is there anything in PB or WinAPI that uses the same method?

What I was thinking was something like this:

eg.

FSFirst
Syntax: FName$=FSFirst(p$,attr)

Action: Searches for the first file on a disk to fulfill the
criteria specified in p$ (eg: "*.TXT"). If found, the
filename and attributes are returned to a buffer.
The parameter 'attr' is the file atributes to search on. ie
file/folder

FSNext
Syntax: FName$=FSNext()

Action: Search for the next file which fulfills the conditions of
FSFirst.

Dunno, what do you genii think :?:

Posted: Fri Mar 12, 2004 1:09 pm
by Kale

Code: Select all

Result = ExamineDirectory(#Directory, DirectoryName$, Pattern$)
Result = NextDirectoryEntry()
FileName$ = DirectoryEntryName()

Posted: Fri Mar 12, 2004 2:48 pm
by The Real KrazyK
Thanks for that Kale - I knew there had to be something. I was looking in the wrong place - in the file routines :roll:

Posted: Fri Mar 12, 2004 3:30 pm
by Kale
believe it or not it is actually extremely helpful to read through the entire manual, you will find loads of things you have never seen before! and it will give anyone a very good grounding for the language. :D