-
Now, in the MSDN, Len is supposed to return the length of the string, and LenB is supposed to return the length of the string in bytes, right?
But when I ran this:
Code:
Private Sub Form_Load()
Dim header As String
header = Space(8)
MsgBox Len(header) 'an answer of 8
MsgBox LenB(header) 'answer of 16 (?)
header = "12345678"
MsgBox header 'answer "12345678"
MsgBox Len(header) '8
MsgBox LenB(header) '16
'the file contains the character "1" in it
MsgBox FileLen("c:\windows\desktop\test.txt") 'answer of 1
msgbox LenB("1") 'answer of 2!!
End Sub
Why does LenB say that "1" uses 2 bytes? It seems that one character always takes up 2 bytes, but FileLen reports a file with the same character as 1 byte. Why is this so?
Thanks
Sunny
-
LenB returns the number of bytes used to represent the string (two per character), while FileLen returns the actial number of bytes in a file