Qbasicnews.com

Full Version: REQ: Stored command execution
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Code:
case "IF A<B THEN A = C+B * (CalculateFirstPrime(B^2))":
...
...

Y'know... Wink
Hmmm...
Well you could have your program output the code you want to be executed to a text file, SHELL "FB " + filewhatever$ and then chain to the program that is output by FB then chain back to the original program. You'd still need to figure out how to get the program to return to the point right after where you had chained away once you returned.
Messy but I bet that might just work.
Code:
const program1$="jumper1"
const program2$="jumper2"

PRINT "Program 1"

IF jump = 1 THEN GOTO returnfromchain

OPEN program2$+".bas" FOR OUTPUT AS #1
PRINT #1, "Print " + CHR$(34) + "Program 2" + CHR$(34)
PRINT #1, "jump = 1"
PRINT #1, "chain " + CHR$(34) + program1$+".exe" + CHR$(34)
CLOSE #1

SHELL "FBC "+program2$+".bas"
CHAIN program2$+".exe"

returnfromchain:

print "done"
do
loop

That should do the trick, I think, haven't tested it.
Cool hack if it works though
It actually works! BTW, you don't need the chain argument in program two. When program 2 finishes, control is automatically returned to program 1 (at least when I try it). How about adding a function that does this automatically, and includes a copy of the fb compiler in your exe if the function is used?
Quote:How about adding a function that does this automatically, and includes a copy of the fb compiler in your exe if the function is used?
How about no? Adding 250KiB to the executable for just one function is completely pointless and utterly silly. Dinosaur had the most useful idea here. Not to mention it is far smaller at that. :wink:
Yeah, it's something that less than 0.00000001% of people will use.
Pages: 1 2 3