Software Components Home

Append String to File

Back

Demonstrates how to append a string to a file, creating the file if it already exists.
    Dim intFileHandle As Integer
    Dim myStr As String
    myStr = "Hello World"
    intFileHandle = FreeFile
    Open "myFile.txt" For Append As #intFileHandle
    Print #intFileHandle, myStr
    Close #intFileHandle