Question about files

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!
Post Reply
User avatar
bongomeno
Veteran
Posts: 266
Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:

Question about files

Post by bongomeno »

other than posts about spam, this place seems like a ghost town lately! :(
Later this week Ill try to post some updates on my GUI Dream16. :D

annnyyywaaay...

Is there any way that I can read the contents of a directory in Qbasic? Lets say that I wanted to return file names and/or info from C:\, like DIR in ms-dos. Can I do that in Qbasic by itself or do I need to use assembly?

Thanks.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Pipe the information to a file and read that.

CHDIR to a folder path or use the path in a SHELL:

SHELL "DIR *.BAS /B > Folder.dat" ' /B returns nothing else but a list of filenames.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo »

burger2227 wrote:Pipe the information to a file and read that.

CHDIR to a folder path or use the path in a SHELL:

SHELL "DIR *.BAS /B > Folder.dat" ' /B returns nothing else but a list of filenames.

Ted
I know what you mean, but instead of saying "pipe", you should say "redirect."

Regards.... Moneo
User avatar
bongomeno
Veteran
Posts: 266
Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:

Post by bongomeno »

Thanks for the reply, I will try this asap
Post Reply