Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making directories and files from within BASIC 2

Status
Not open for further replies.

cykx

Technical User
Apr 9, 2005
2
0
0
PR
Hi, I learned GWBASIC in high school and am trying to make a program that will make a directory when it is run. Also, one that can make a file and save it under an extension as .txt. Is this possible to do. The idea is for me to be able to put info in the program then once its compiled and run it make the proper directories and files. Thanks, Id appreciate it alot if you could help me out on this. I have 2 very old books on QBasic and BASIC but havent really been able to find what I need.
 
Try the shell command - it gives you access to the DOS shell from within your BASIC program so you can create directories, copy files, etc. just like you're at the DOS prompt.

If you still have problems, drop me another note and give me some specifics and I'll be glad to help.

Tom

"My mind is like a steel whatchamacallit ...
 
What BASIC are you using to write this code in.

--MiggyD

--> It's a bird! It's a plane! No, it's an OS update patch! Ahh!! <--
 
Qbasic, the free one. Think its 1.1. Y got into shell but am having problems figuring out how to make it do what i want. I have a BASIC hand book with all the commands and how to enter the parameters but it isnt helping or working. I can get into DOS and I can get batches working, thin is I dont want it to run, do what it has to do, and exit. If I let anyone controlthe program Ill be receiving countless "It doesnt work" messages msn.
 
MKDIR dirname$ - make a directory

OPEN "myfile.txt" FOR OUTPUT AS #1
PRINT #1, "whatever you want printed, one line per statement"

CLOSE #1

SYSTEM - closes the QBASIC interpreter after running your program, more than just using END which leaves QBASIC open

Your original statement indicated that you would compile the program, not just run it through the interpreter.

The old QBASIC books I have cover these points in them.

As well, there's a forum specifically for QBASIC, if you have questions about that in particular:

forum314

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top