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:
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?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
Thanks
Sunny


Reply With Quote
