' Text file operations: OPEN FOR INPUT/OUTPUT/APPEND, PRINT#, INPUT#, CLOSE
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL s AS STRING

    OPEN "test_out.txt" FOR OUTPUT AS #1
        PRINT #1, "Hello from PBXB64!"
        PRINT #1, "Line two of text output."
    CLOSE #1

    OPEN "test_out.txt" FOR INPUT AS #1
        INPUT #1, s
        PRINT "Read line:"; s
    CLOSE #1

    OPEN "test_out.txt" FOR APPEND AS #1
        PRINT #1, "Appended line."
    CLOSE #1

    KILL "test_out.txt"
    PRINT "Text file test complete."

    FUNCTION = 0
END FUNCTION
