PowerBASIC Users Meeting Point

Full Version: $EOF when using Line Input#
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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