Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting files in a directory
#1
Alright i just started working on making a program that could save and load stuff. But I don't know how to print out and store the directory. kinda like a gui. Could somone tell me?
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#2
PyroKid,

You can do something like this to get the list of files:

Code:
DIM FileArray() AS String
DIM Counter     AS LONG
DIM WorkFile    AS STRING

WorkFile = DIR("*.*")   ' CHANGE FILE SPECS IF NEEDED
COUNTER = 0
DO WHILE LEN(WorkFile) <> 0
   Counter = Counter + 1
   REDIM PRESERVE FileArray(Counter) AS STRING  
   FileArray(Counter) = WorkFile
   WorkFile = DIR
LOOP
hen they say it can't be done, THAT's when they call me ;-).

[Image: kaffee.gif]
[Image: mystikshadows.png]

need hosting: http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
Reply
#3
Definitely easier with a windows environment DIR.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#4
FileArray(Counter) = WorkFile
must be
FileArray(Counter-1) = WorkFile

First arrayindex are 0 by default or not?

Joshy
Code:
DO WHILE LEN(WorkFile) <> 0
   REDIM PRESERVE FileArray(Counter+1) AS STRING  
   FileArray(Counter) = WorkFile
   Counter+=1
   WorkFile = DIR
LOOP
sorry about my english
Reply
#5
:

Code:
Option Dynamic
...
DO WHILE LEN(WorkFile) <> 0
   REDIM PRESERVE FileArray(Counter) AS STRING    
   FileArray(Counter) = WorkFile
   Counter = Counter + 1
   WorkFile = DIR
LOOP

Maybe this works better.
Reply
#6
Hello Neo,
first counter is 0
and
redim preserve array(0) as type
is not the same as
redim preserve array(1) as type

or not ?
what for a fb version you are using and Win or Lin?

Joshy
sorry about my english
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)