B4J Code Snippet [B4X] AppendToTextFile

Description: appends text to a text file ?

Author: @Erel (original code here)

Platforms: B4A, B4J, B4i

AppendToTextFile:
Private Sub AppendToTextFile(Dir As String, FileName As String, Text As String, NewLine As Boolean)
    If NewLine Then
        Text = CRLF & Text
    End If
    Dim out As OutputStream = File.OpenOutput(Dir, FileName, True)
    Dim b() As Byte = Text.GetBytes("utf8")
    out.WriteBytes(b, 0, b.Length)
    out.Close
End Sub
 

Attachments

  • AppendToTextFile.zip
    9.6 KB · Views: 337
Top