-
Hello!
I use Hoffman algorithm to compress string. It adds vbCr at the beginning of compressed string's header. Then I want to load that string from file. In notepad I see all text in one line so I used Line Input # statement. But I realised that I was wrong, because Line Input accepts vbCr as enter (new line), so it ends here even if it has read just 2 charachters.
How can I read whole line without using Line Input # statement which doesn't work?
-
Just adding:
In compressed string are also vbLf constants - Chr(13) and these are also supposed to be new line (for VB).
The thing I need is that then new line can be there where are both characters (vbCrLf).
Looping through all file, finding it, retrieveing it and decompressing would be useless (100k file) and it would take a long time. Any suggestions?
-
fyi:
vbLF = chr(10), not 13! :)
-
Just read the entire file into a string. :rolleyes:
Code:
Dim sFile As String, btFileNum As Byte
btFileNum = FreeFile
Open "C:\A\B\C\D\E\F.G" For Input As btFileNum
sFile = Input(LOF(btFileNum), btFileNum)
Close btFileNum
' Now, the string sFile contains the entire contents of the file
-
And if I read all file to string, then I can split it, isn't that right?
-
-
<?>
You can if you have somthing to split on.
Split() Function in VB