a function that prints whole text file on screen

Started by ron77_db, Apr 11, 2022, 05:26 PM

Previous topic - Next topic

ron77_db

this little function will read the text in the text file and will print it to the console/screen

'improve print of whole text file on screen
SUB txtfile(f AS STRING)
	CLS
	DIM AS STRING buffer
	DIM h AS LONG = FREEFILE()
	if OPEN(f FOR BINARY access read AS #h) then
		print "file could not be opened!"
	elseif (lof(h) < 1) then
		print "file could not be read!"
	else
		buffer = SPACE(LOF(h))
		GET #h ,  , buffer
		CLOSE #h
		PRINT buffer
	end if
End SUB