Qbasicnews.com

Full Version: List of file names
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am working on a project where I need to list all file names in a directory with the same extension. The list can either be in an array or a text file to be used by the program.
And you're telling us this because?

...
...
...

Oh, you need help Tongue
Look up: Int 21h AH=4E and Int 21h AH=4F.

That's what you need if you wish to run without external files.

If you want external files, you could do something like:
Code:
OPEN "SHOW.BAT" FOR OUTPUT AS #1
   PRINT #1, "DIR *.EXE > MYFILE.DAT"
CLOSE #1

SHELL "SHOW.BAT" 'or SHELL "CMD SHOW.BAT"
Then you only need to read the MYFILE.DAT Wink
Neo,
Why do I need to do the DIR via a batchfile?
Why can't I just do:

SHELL "DIR *.EXE/B > MYFILEE.DAT"

Depending on the operating system you might have to:

SHELL "CMD DIR *.EXE/B > MYFILEE.DAT"

The /B is for bare output --- filename only. I'm sure you don't need all the other information.

PS: Watch out: since you're probably running a Windows machine, there is a remote posibility that you might have some Windows filenames in the subject directory. Example: If you have a file called CHACHACHA.EXEL in the directory, all the above DIRs will find and use it because it has .EXE in it.
*****
Quote:And you're telling us this because?

...
...
...

Oh, you need help Tongue

That post was about as pointless as this one pointing out that fact.
Then why did you post?