File Searching

Just starting out? Need help? Post your questions and find answers here.
The Real KrazyK
User
User
Posts: 12
Joined: Thu Dec 18, 2003 1:17 pm
Location: UK

File Searching

Post 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 :?:
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Code: Select all

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

Image
The Real KrazyK
User
User
Posts: 12
Joined: Thu Dec 18, 2003 1:17 pm
Location: UK

Post 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:
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post 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
--Kale

Image
Post Reply