Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loading files into a program
#1
I'd like the prog to display what is on a certain directory, so it isn't necessary (i hate this word) to remember the name when opening the file. How would I do that?
Reply
#2
Look for the program DirX on qb45.net
am an asshole. Get used to it.
Reply
#3
Check the FILES command. Or try the file browser modules you can find at my site
Antoni
Reply
#4
Look up DIR$ command which is available only in QB71(a.k.a PDS)
Reply
#5
Quote:Look up DIR$ command which is available only in QB71(a.k.a PDS)
Don't call it PDS, since QBasic is hardly a "Professional Development System" anymore.
am an asshole. Get used to it.
Reply
#6
He called it precisely what the creators of it called it. Qbasic wasn't ever a "professional development system." PDS was always just *that*. It was never Qbasic. Qbasic was never PDS.
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply
#7
Quote:Don't call it PDS, since QBasic is hardly a "Professional Development System" anymore.

Oh c'mon give me a break! I just wrote PDS because some people think QB 7.1 and PDS are two different versions of QB where as they arent!
Reply
#8
Quote:I'd like the prog to display what is on a certain directory, so it isn't necessary (i hate this word) to remember the name when opening the file. How would I do that?
I assume that if there is more than one file on the directory, then your program will at some point open more than one file. Am I ok so far?

Antoni mentioned using the FILES command. This works, BUT it puts the directory list onto the screen. I don't think this is what you want. TheBigBasicQ mentioned using DIR$, but like he said that's only with PDS.

Here's what I would do:
Code:
PATH.FILESPEC$ = "\the path you want\the filespec you want"´
'                      Example: PATH.FILESPEC$ = "\MYDIR\QB\*.BAS"
DIRCMD$ = "DIR"
'                      You may want to add switches to the DIR command.
S$=DIRCMD$ + " " + PATH.FILESPEC$ + ">DIRTEMP"
SHELL S$
OPEN "DIRTEMP" FOR INPUT AS #1
' ... here you read in and store the file names.
The SHELL command executes the DIR (of your choice) for the directory path and filespec that you want to process, and writes the directory listing to the DIRTEMP file which you later process. Depending on your choice of DIR switches, you may have to parse out the file names.
NOTE: If you run under different versions of MS-DOS or different versions of Windows, the format produced by the DIR command may be different.
*****
Reply
#9
So, thanks for all the tips. I didn't know any of the suggested commands like files, chdir, etc. I also tried Moneo's suggestion, but that was in a hurry, and didn't work. I'll take a better look after it later, after coming back from my interrail adventures........ :bounce:
Reply
#10
I used to have a program that Na_th_an gave to me that got the directory of a file such as windows and saved it to a text file so that it could be displayed in any way withing QB but I don't remember how he did it. You should ask him.
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)