VB Code:
Public Sub PutString(ByVal FileHandle As Integer, ByVal Text As String)
On Error Resume Next
Dim TextArray() As Byte, TextLength As Long
Err.Clear
Text = Text
If Len(Text) <= 0 Then
TextLength = 0
Put #FileHandle, , TextLength
Else
TextLength = Len(Text)
Put #FileHandle, , TextLength
MsgBox "Saved Text Length: " + CStr(TextLength) + vbCrLf + CStr(Err.Description)
TextArray = StrConv(Text, vbFromUnicode)
MsgBox "Converted Text" + vbCrLf + CStr(Err.Description)
Put #FileHandle, , TextArray
MsgBox "Saved Text: " + Text + vbCrLf + CStr(Err.Description)
End If
Err.Clear
End Sub
That's the function, the error occurs at the Put #FileHandle, , TextLength line.