I was making an file encryptor/decryptor and I encountered some problem of FSO.ReadAll
not reading the whole file's content.
Below is the code:
Sub EncryptFile(file)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set readf = FSO.OpenTextFile(file, 1)
c = readf.ReadAll
readf.Close()
Set readf = Nothing
'MsgBox only shows the first 4 characters of the file. ("ÿØÿà")
'Does ReadAll stop its reading when the character is unreadable for it?
'n = MsgBox(c, , "")
'^^^^^ Result: ÿØÿà
'...more below, but no longer needed for the question
End Sub
MsgBox
result:
File contents (yes, the file is .JPG):
What seems to be the problem? Is it because ReadAll
stops reading because the next character would be unreadable for the encoding or something, or anything else?