PowerBASIC Users Meeting Point
$EOF when using Line Input# - Printable Version

+- PowerBASIC Users Meeting Point (http://pump.richheimer.de)
+-- Forum: User to User Discussions (http://pump.richheimer.de/forumdisplay.php?fid=3)
+--- Forum: PowerBASIC Console Compiler (http://pump.richheimer.de/forumdisplay.php?fid=5)
+--- Thread: $EOF when using Line Input# (/showthread.php?tid=49)



$EOF when using Line Input# - Albert Richheimer - 03-12-2025

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