Page 1 of 1

Newbiw program help

Posted: Mon May 31, 2004 4:57 am
by hamfreak2002
hi, i am new to qbasic or programing but i have got a good idea on the basics, but i cant seem to open and save to a text file or get the program to come out of a SUB back to the main program. any tips?

Re: Newbiw program help

Posted: Tue Jun 01, 2004 4:39 am
by Guest
Start with sequential files (usually text files)

open "my.fil" for output as #1
print #1,"Hello"
close #1

open "my.fil" for input as #1
line input #1,LL$
print LL$
close #1
(should print hello on the screen)

-----------
subs
--------
declare sub firstone(x$)
firstone "hello"
print "Back from Sub"
stop
sub firstone(msg$)
print msg$
print "exiting sub"
'sub will end when it gets here or use exit sub
end sub

Simplistic examples but something to get you started