Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read a text and attribute it to a variable
#8
... could use RUN on the BASIC source code? That's in addition to the code that loads that same source code as a text file.

The problem is that if there is no EXE file on Windows for TEST.BAS it will be created by the QB64 compiler and it will take many seconds. If the EXE already exists then it's just run. However, it might not have come from the source code you thought was in TEST.BAS! This is easy to investigate: without compiling TEST.BAS, just find any other EXE file, copy it to QB64 directory and rename it TEST.EXE. The RUN statement will happily run that without checking to see if the BASIC source code was compiled to get that EXE file.

You could add a sanity check: first load the BASIC source code as text file. Then make sure is the right one by searching a string loaded from the file, such as + CHR$(138) + . If there is a match then you ask to RUN that source code.

But maybe I shouldn't be proposing to use RUN...

Otherwise you will need a BASIC interpreter as part of your QB64 program. Load the BASIC source code as text file, then have the interpreter work with it for the result you originally expected.
Reply


Messages In This Thread
RE: Read a text and attribute it to a variable - by mnrvovrfc - 11-24-2023, 12:56 PM



Users browsing this thread: 8 Guest(s)