zero byte output after executing program

Announce and discuss the progress of your various programming-related projects...programs, games, websites, tutorials, libraries...anything!

Moderators: Pete, Mods

Post Reply
mikefromca
Coder
Posts: 41
Joined: Wed Oct 16, 2019 11:28 am

zero byte output after executing program

Post by mikefromca »

This is a QuickBasic 1.1 and MS-DOS question

I created the following code and saved it as test.bas in the root of my C drive:

Code: Select all

print "TESTING 123 ABC"
system
Then I created the following code as a new file:

Code: Select all

shell "\path\to\qbasic.exe /RUN \test.bas > \test.out"
open "\test.out" for binary as #1
print lof(1)
close #1
end
as soon as I executed the new code, Qbasic reports test.out has a size of zero bytes. yet if I execute the same command in DOS as follows:

Code: Select all

\path\to\qbasic.exe /RUN \test.bas > \test.out
then the screen flickers blue for a brief second as if it is loading the Qbasic interpreter then it exits and when I check the \test.out file, it shows the expected output of:

Code: Select all

TESTING 123 ABC
Now the story is different if I compile test.bas into its own EXE (lets call it test.exe here and its stored in the root of the C drive). so if instead executed this code instead:

Code: Select all

shell "\test.exe > \test.out"
open "\test.out" for binary as #1
print lof(1)
close #1
end
then the file length is reported correct.

Makes me think something funny is going on with the qbasic interpreter unless my DOSBOX is acting up.

Has anyone else experienced this issue? and how have you corrected it?
Erik
Veteran
Posts: 72
Joined: Wed Jun 20, 2007 12:31 pm
Location: LI, NY
Contact:

Re: zero byte output after executing program

Post by Erik »

That's weird.

Tried the same exact thing in DOSbox here in QB1.0 and QB4.5 and it returned a LOF = 17.

TEST.BAS:

Code: Select all

PRINT "TESTING 123 ABC"
SYSTEM
TEST2.BAS:

Code: Select all

CLS

SHELL "qb /run test.bas > test.out"
SHELL "type test.out"

OPEN "test.out" FOR BINARY AS #1
    PRINT "LOF ="; LOF(1)
CLOSE #1

END
Output:

Code: Select all

TESTING 123 ABC
LOF = 17
Also tried using absolute paths like you did and worked as well.
Post Reply