03-12-2025, 08:25 AM
(This post was last modified: 03-12-2025, 11:06 AM by Albert Richheimer.)
Source code moved from PB DOS over here, in reply to @Andy Dee:
Code:
#compile exe
#dim all
function pbmain () as long
local hFile as long
local sFile as string
local sTemp as string
'
' Setup strings
' -------------
'
sTemp = "ABCDEF" + $EOF + "abcdef"
sFile = "Data.txt"
'
' Create Data.txt
' ---------------
'
hFile = freefile
open sFile for output as #hFile
print #hFile,sTemp;
close #hFile
'
' Read Data.txt using get$
' ------------------------
'
hFile = freefile
open sFile for binary as #hFile
get$ #hFile,lof(hFile),sTemp
close #hFile
stdout "Using get$: "+sTemp
'
' Read Data.txt using line input#
' -------------------------------
'
hFile = freefile
open sFile for input as #hFile
line input #hFile,sTemp
close #hFile
stdout "Using line input#: "+sTemp
'
' Clean up
' --------
'
kill sFile
end function
„Let the machine do the dirty work.“
The Elements of Programming Style, Brian W. Kernighan, P. J. Plauger 1978
The Elements of Programming Style, Brian W. Kernighan, P. J. Plauger 1978