Buchempfehlung
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Umfassend, aber leicht verständlich führt dieses Buch in die Programmierung von ATMEL AVR Mikrocontrollern ein. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

FolderSearch die 2.

Uploader:MitgliedEternal_Pain
Datum/Zeit:14.07.2007 21:40:30

Type SaveFolders
    Entrys as UInteger
    Folders as String
    Start as UInteger ptr
    Len as UInteger ptr
End Type

Type FindInf_
    Start as String
    Mask as String
End Type


'**************************************************************************
Sub NewEntry (byref Save as SaveFolders , byval Entry as String)
'**************************************************************************

    Save.Start    = ReAllocate (Save.Start,4+(Save.Entrys*4))
    Save.Len      = ReAllocate (Save.Len,4+(Save.Entrys*4))

    Save.Start[Save.Entrys] = Len(Save.Folders)+1
    Save.Len[Save.Entrys]   = Len(Entry)

    Dim Buffer as String

    Save.Folders+=Entry

    Save.Entrys+=1
'--------------------------------------------------------------------------
End Sub
'--------------------------------------------------------------------------

'**************************************************************************
Sub ClearEntry (byref Entry as SaveFolders)
'**************************************************************************
    Entry.Folders=""
    Entry.Entrys=0
    Deallocate (Entry.Start)
    Deallocate (Entry.Len)
'--------------------------------------------------------------------------
End Sub
'--------------------------------------------------------------------------

'**************************************************************************
Function GetEntry (byref FHolder as SaveFolders, byval Entry as Integer) as String
'**************************************************************************
    If Entry<0 Then Return ""
    If FHolder.Entrys=0 Then Return ""
    If Entry>FHolder.Entrys-1 Then Return ""

    Return mid(FHolder.Folders,FHolder.Start[Entry],FHolder.Len[Entry])
'--------------------------------------------------------------------------
End Function
'--------------------------------------------------------------------------

'**************************************************************************
Sub ScanDir (byref FHolder as SaveFolders, byval SearchDat as FindInf_)
'**************************************************************************
    If mid(SearchDat.Start,Len(SearchDat.Start),1)<>"\" Then SearchDat.Start+="\"

    Dim FF as Integer=FreeFile

    Dim FBuffer as String

    Open Pipe "Dir "+SearchDat.Start+" /AD /B /S" for input as #FF
    While Not Eof(FF)
        Line Input #FF,FBuffer
        If INSTR (lcase(FBuffer),lcase(SearchDat.Mask)) Then NewEntry (FHolder,FBuffer)
    Wend
    Close #FF
'--------------------------------------------------------------------------
End Sub
'--------------------------------------------------------------------------

Dim FF as SaveFolders
Dim SInf as FindInf_
ClearEntry (FF)
SInf.Start="D:\FreeBasic"
SInf.Mask="test"

ScanDir (FF,SInf)


?FF.Entrys
For l as integer=0 to FF.Entrys-1
    ?GetEntry(FF,l)
Next l

Sleep
ClearEntry (FF)