I am using the following code to load a string of text from a file.

cCnt = 0
        fFree = FreeFile
        Open txtDatafile.Text For Input As #fFree
            Do
                cCnt = cCnt + 1

                fndRecord = (cCnt * RecLen) - RecLen
                If cCnt >= 2 Then fndRecord = fndRecord + 1
                If fndRecord = 0 Then fndRecord = 1
                Seek #fFree, (fndRecord)
            
                ' get full record
                dataIN = Input(RecLen, #fFree)

                getName dataIN, strSource
                
                .lstCheckLinfo.AddItem useName
                
            Loop Until EOF(fFree) Or cCnt = 10
        Close #fFree
    End With

My problem is the file contains null characters.
When dataIN is populated it ignores the null characters and gets characters from the next record.

eg data:

*=null
AAAAAAAAAAAAAA*****AAAA
BBBBBBBBBBBBBB*****BBBB
CCCCCCCCCCCC*****CCCC

dataIN = AAAAAAAAAAAAAAAAAABBBBB
dataIN = BBBBBBBBBBBBBBBBBBCCCCC
dataIN = CCCCCCCCCCCCCCCCDDDDD
etc

Is there a way to load the null character so I can replace the null with a space.

Thanks in advance
pG

You have to open the file in BINARY mode. This mode allows you to read files that contain binary records instead of lines of text.