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!

Moderators: Pete, Mods

Post Reply
User avatar
bongomeno
Veteran
Posts: 231
Joined: Wed Dec 10, 2008 9:08 am
Location: San Bernardino CA
Contact:

Question about files

Post by bongomeno » Wed Feb 24, 2010 12:22 am

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.
Home: http://www.geekbasic.com" target="_blank
Forum: http://www.geekbasic.com/index.gbws?$page=forumsmain" target="_blank
QB64 powered web server: http://www.geekbasic.com/index.gbws?$pa ... inter=%201" target="_blank

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

Post by burger2227 » Wed Feb 24, 2010 2:26 am

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 » Wed Feb 24, 2010 6:43 pm

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: 231
Joined: Wed Dec 10, 2008 9:08 am
Location: San Bernardino CA
Contact:

Post by bongomeno » Thu Feb 25, 2010 11:03 am

Thanks for the reply, I will try this asap
Home: http://www.geekbasic.com" target="_blank
Forum: http://www.geekbasic.com/index.gbws?$page=forumsmain" target="_blank
QB64 powered web server: http://www.geekbasic.com/index.gbws?$pa ... inter=%201" target="_blank

Post Reply