Hi.

I need to swap every two characters in a file.
Eg :
abcdefgh -> badcfehg

The code I'm using at the moment is :
Code:
Option Explicit

Private var_line As String

Private Sub Command1_Click()
    If (Text1.Text <> "") And (Text2.Text <> "") Then
        Label1.Caption = "Working"
        Open Text1.Text For Binary Access Read As #1
            Open Text2.Text For Binary Access Write As #2
                Do While Loc(1) < LOF(1)
                    var_line = Input(2, #1)
                    DoEvents
                    var_line = Right(var_line, 1) & Left(var_line, 1)
                    Put #2, , var_line
                Loop
            Close #2
        Close #1
        Label1.Caption = "Finished"
    End If
End Sub
The code must work in such a way that if it is run again on the file, one gets the original file back.
Eg : f(f(x)) = x

Anyone have a better approach ?

- jamie