In my Vb app. I need to read Test.txt file which has large amount of formated text and sometimes NULL characters.
So, for testing I made this file like this:
s = "h" & vbNullChar & "e" & vbNullChar & "l" & vbNullChar & "p" & vbNullChar
n = FreeFile()
Open "c:\Test.txt" For Output As #n
Print #n, s
Close #n
Now in VB I read this file like this:
n = FreeFile()
Open "c:\Test.txt" For Input As #n
Text = Input(LOF
, n)
Close #n
But I got error: Input past end of file 62.
Ok, I tried this way.
RichTextBox.LoadFile "c:\Test.txt", 1
In my RichTextBox I see: “h_e_l_p_” where “_” is NULL character
Then I say:
Text=RichTextBox.Text
But variable Text got this value:
Text = ”h”
How to read the whole formated Test.txt with NULL characters?
So, for testing I made this file like this:
s = "h" & vbNullChar & "e" & vbNullChar & "l" & vbNullChar & "p" & vbNullChar
n = FreeFile()
Open "c:\Test.txt" For Output As #n
Print #n, s
Close #n
Now in VB I read this file like this:
n = FreeFile()
Open "c:\Test.txt" For Input As #n
Text = Input(LOF
Close #n
But I got error: Input past end of file 62.
Ok, I tried this way.
RichTextBox.LoadFile "c:\Test.txt", 1
In my RichTextBox I see: “h_e_l_p_” where “_” is NULL character
Then I say:
Text=RichTextBox.Text
But variable Text got this value:
Text = ”h”
How to read the whole formated Test.txt with NULL characters?