Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input into a program

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am new to qbasic and know only very limited comands. I have a program that outputs info into a text file using append. I need my program to input the entire file into my program. I am using a .dat file and print #. I have qbasic 1.1 and 4.5.
 
Are you sure you have to have the full contents of that data-file into (QB's) memory ?

Maybe you can read your data-file line-by-line, and process it that way ?

Handle=freefile
open "yourfile.dat" for input as #Handle
while not eof(Handle)
line input #Handle,Line$
'-- here you can alter the contents of 'line$'
' to anything you like ...
print Line$
wend
close #Handle
 
It would be much easier to modify text documents using GET and PUT. This is how all word processors i've ever seen do it.

DIM text(16380) 'max unless you use /AH
OPEN "file.dat" FOR RANDOM AS #1
FOR a = 1 TO LOF(1)
GET #1, a, text(a)
NEXT
CLOSE
 
INPUT# is alright. I use it to load fonts, but only because it seems to be more compact. GET and PUT are 5-10 times faster.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top