Creare Videogiochi - Game Developer

Versione completa: Lista delle cartelle
Al momento stai visualizzando i contenuti in una versione ridotta. Visualizza la versione completa e formattata.
In un programma con Dark Basic mi sono trovato davanti ad un problema. Dovendo accedere ad una quantità indefinita e casuale di cartelle vorrei sapere come ottenere 1 ad 1 i nomi delle cartelle per potervi accedere, leggere ed uscire per poi passare alla cartella successiva. Solo il Comando DIR non serve a gran che, qualcuno ha delle idee? Huh
Adatta a quello che ti puo' servire questo esempio tratto dagli esempi di DbPro :



rem File Functionality

rem Standard Setup Code for all examples
set text font "arial" : set text size 16
set text to bold : set text transparent




rem Run file tests
gosub _checklistfiles : gosub _waitkey
gosub _checklistdrives : gosub _waitkey
gosub _diranddrive : gosub _waitkey
gosub _makefiles : gosub _waitkey
gosub _deletefiles : gosub _waitkey
gosub _sequentialwrite : gosub _waitkey
gosub _sequentialread : gosub _waitkey
gosub _readtoend : gosub _waitkey
gosub _viewfiles : gosub _waitkey
gosub _showdata : gosub _waitkey

rem End program
end

_checklistfiles:
cls : print "CHECKLIST FILES"
perform checklist for files
for f=1 to checklist quantity()
print "> ";checklist string$(f)
next f
return

_checklistdrives:
cls : print "CHECKLIST DRIVES"
perform checklist for drives
for f=1 to checklist quantity()
print "> ";checklist string$(f)
next f
return

_diranddrive:
cls : print "DRIVELIST AND DIR"
drivelist
dir
return

_makefiles:
cls : print "MAKE FILES AND FOLDERS"
make directory "leedir"
set dir "leedir"
make file "leefile.txt"
copy file "leefile.txt","newfile.txt"
rename file "newfile.txt","renamed.txt"
move file "renamed.txt","moved.txt"
dir
set dir ".."
return

_deletefiles:
cls : print "DELETE FILES AND FOLDERS"
set dir "leedir"
delete file "leefile.txt"
delete file "moved.txt"
dir
set dir ".."
delete directory "leedir"
return

_sequentialwrite:
cls : print "WRITE SEQUENTIAL FILES"
if file exist("seq.txt") then delete file "seq.txt"
open to write 1,"seq.txt"
write file 1,1000
write byte 1,255
write word 1,65535
write long 1,2200000
write float 1,42.24
write string 1,"hello world"
write fileblock 1,"file.dat"
close file 1
print "file written"
return

_sequentialread:
cls : print "READ SEQUENTIAL FILES"
open to read 1,"seq.txt"
read file 1,a : print a
read byte 1,a : print a
read word 1,a : print a
read long 1,a : print a
read float 1,a# : print a#
read string 1,a$ : print a$
read fileblock 1,"file2.dat"
close file 1
print "file read"
return

_readtoend:
cls : print "READ EVERY BYTE OF A FILE"
open to read 1,"seq.txt"
if file open(1)=1
c=0
while file end(1)=0 and c<1000
read byte 1,A
print ">";A
inc c
endwhile
close file 1
endif
return

_viewfiles:
cls : print "VIEW EACH FILE IN A FOLDER"
find first
while get file type()<>-1
print "Type:";get file type();
print " Name:";get file name$();
print " Date:";get file date$()
find next
endwhile
return

_
_showdata:
cls : print "SHOW FILE DATA"
print "appname:";appname$()
print "windir:";windir$()
print "dir:";get dir$()
print "exist:";file exist("seq.txt")
print "pathexist:";path exist("leedir")
print "size:";file size("seq.txt")
return

_waitkey:
print : print "Press Key"
wait key : sleep 500
return
Si già li avevo visti gli esempi ma non mi aiuta per niente. Ciò che ho detto prima infatti si potrebbe fare solo con i file tramite "Fin First" e "Find Next" e non con le cartello. Vabbe al massimo posso far inputtare all'untente anche se sarà + scomodo Smile
Devi Acquistare un plug in per esempio BlueGui

Cerca nel forum ed acquistalo !

Zapetino

lo ho comprato io se nn è illegalo lo posto
Penso sia illegale... meglio che non lo posti xk senno friskon ci lincia xD

Zapetino

XD se lo vuoi te lo passo in pm (cancellate se violo il regolamento)
Non c'è bisogno grazie xD Smile

Zapetino

okey me lo gusto da solo XD