Scrolling
Re: Scrolling
I am unable to determine what you want.Lee wrote:Ok, when i use the command prompt to print stuff in qbasic, how would i beable to scroll through it? use VIEW? I dunno. I cant even guess on how to put the results in an array :?
Could you please explain further. What is the problem? I'll make a problem up for you and you can see how to explain problems
Mac
---------------------------------------
I am running a program that prompts me for input, which I provide. It then prints some results and then asks the next question. As this process continues, the old printouts scroll off the top of the page. But I want to look at all my output. How can I scroll up and see printouts that have scrolled off the page.
-----------------------------------------
Yes! thats my problem...Execpt Im using teh Command prompt command "Find" and then it prints the stuff out like nuts and it goes off the top of the screen How do I scroll back up?
EDIT: Can you please help to explain to me what teh formula for the GFX is?
Example:
That from this tutorial http://www.petesqbsite.com/forum/postin ... st&p=15939
EDIT: How do I put variables in teh DRAW command?
EDIT: Can you please help to explain to me what teh formula for the GFX is?
Example:
Code: Select all
SCREEN 13
RESTORE Fire
DIM FireDrawing (0 TO 32) AS INTEGER
FOR PY = 0 TO 5
FOR PX = 0 TO 5
READ A
PSET (PX, PY), A
NEXT PX
NEXT PY
GET (0,0)-(5,5), FireDrawing
PUT (20, 20), FireDrawing
Fire:
DATA 00,00,04,04,00,00
DATA 00,04,14,14,04,00
DATA 00,04,14,14,04,00
DATA 04,14,14,14,14,04
DATA 04,14,14,14,14,04
DATA 04,14,14,14,14,04
DATA 04,04,04,04,04,04
EDIT: How do I put variables in teh DRAW command?
- coma8coma1
- Veteran
- Posts: 100
- Joined: Sat Dec 08, 2007 5:29 pm
- Location: Maryland, USA
[quote="Lee"]Im using the Command prompt command "Find" and then it prints the stuff out like nuts and it goes off the top of the screen. How do I scroll back up?
After the FIND command, add "> MyFile.txt"
(If your operating system doesn't work, write your whole FIND command out to a BAT file and shell to it.
Mac
After the FIND command, add "> MyFile.txt"
(If your operating system doesn't work, write your whole FIND command out to a BAT file and shell to it.
Mac
Code: Select all
Stuff$ = (Whatever you are searching for)
File$ = (Wherever you are searching. perhaps *.doc ?)
cmd$ = "FIND /I " + CHR$(34) + Stuff$ + CHR$(34) + " " + File$
PRINT cmd$
OPEN "MyFile.bat" FOR OUTPUT AS #1
PRINT #1, cmd$ + ">MyFile.txt"
CLOSE
SHELL "MyFile.bat"
PRINT "Here is the stuff you can scroll as you please"
OPEN "MyFile.txt" FOR INPUT AS #1
WHILE NOT EOF(1): LINE INPUT #1, l$: PRINT l$: WEND
CLOSE
SYSTEM
Explain?????????????
??? What's there to explain ???Lee wrote:Can you please explain the code?
I'll do my best:
Stuff$ = (Whatever you are searching for)
You define some variable, I suggested Stuff$ but you could use any name. You put "$" to mean it is a text variable. You set it to whatever you are searching for. You brought up the subject of FIND, not me, so you have to know what the heck you are searching for, right??
File$ = (Wherever you are searching. perhaps *.doc ?)
If you are going to run a FIND command at the DOS prompt, you have to name what to search. You brought up the subject of FIND, not me, so you have to know what file or files you are searching. Don't ask me. Only you know that.
cmd$ = "FIND /I " + CHR$(34) + Stuff$ + CHR$(34) + " " + File$
Here is a variable set to the command you want to run under DOS. Suppose Stuff$="z3" and File$="*.bas", then cmd$ will be
FIND /I "z3" *.bas
which means "search every file in the current directory that ends with ".bas" and print out every occurrences of "z3" or "Z3". (The /I means to ignore case)
PRINT cmd$
Just so we can see what command we are going to do
OPEN "MyFile.bat" FOR OUTPUT AS #1
If you don't know what that command does, then please go away. You need more basics before you can waste our time trying to answer your questions.
PRINT #1, cmd$ + ">MyFile.txt"
This will put the following line in the file your opened, MyFile.bat
(You DO know what a bat-file is, I hope)
FIND /I "z3" *.bas >MyFile.txt
(Assuming the two variable values I made up for you)
CLOSE
(I'll lose my cool and start flaming if you don't know what this does)
SHELL "MyFile.bat"
This will execute the BAT file we just wrote, namely, it will do
FIND /I "z3" *.bas >MyFile.txt
namely it will search for all files in the current directory that end with ".bas" and write any lines that contain "z3" or "Z3" and it will write them into MyFile.txt.
That is the meaning of ">". To DOS, it means to redirect the printout so that rather than going to the screen it goes to a file.
PRINT "Here is the stuff you can scroll as you please"
This is just an instruction I put so that if you run this program, you see what is in file "MyFile.txt".
OPEN "MyFile.txt" FOR INPUT AS #1
WHILE NOT EOF(1): LINE INPUT #1, l$: PRINT l$: WEND
CLOSE
(Don't ask!! If you can't see what this does, you are really wasting my time)
SYSTEM
This terminates your program. Put END there if you want.
Mac
Ok, I should have been more specific there But the only part of the code I didnt understand was With the little greater than sign. But you explained it quiet well Thanks Much!
(off topic) How is it possible to put variables in the draw command?
Code: Select all
FIND /I "z3" *.bas >MyFile.txt
(off topic) How is it possible to put variables in the draw command?
- Seb McClouth
- Veteran
- Posts: 342
- Joined: Wed Nov 09, 2005 7:47 am
- Location: Inside the Matrix...
- Contact:
Or use DOSKEY... in the old glorifull days of Dos, we used DOSKEY for that matter. It could bring back up to a certain amount of commands.
Look around for the source... since DOS is now opensource... hehehe
Look around for the source... since DOS is now opensource... hehehe
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
I suggest starting a new thread with this question. Title "How to draw using DRAW command"Lee wrote:but another question is how do i put variables in the DRAW command?
I presume you couldn't figure out the example in the QBasic HELP section:
SCREEN 1
Triangle$ = "F60 L120 E60"
DRAW "C2 X" + VARPTR$(Triangle$)
DRAW "BD30 P1,2 C3 M-30,-30"
Mac