Here is a function that tests specific characters of a file.

Since it is an internal function it can assume that the given file is at least long enough to hold the characters.

I specify a file handle (so we know that the file exists and is open), a string of HEXADECIMAL characters to be sought, and a starting location.

The starting location is zero-origin; the first character is at seek position "0" in the file.

The starting location can be expressed either as a decimal numeric value or as a character string. If the latter, I assume it is a hexadecimal location. This means that if I am unscrambling a file using a hex portrayal like Vernon Buerg's List.COM I can offer as a direct parameter the displayed hexadecimal location in the file.

This function is useful if I am examining the file in HEX with disregard for the character expression.

<pre>Public Function boolHex(intFile As Integer, strText As String, locStart) As Boolean
' Procedure : boolHex
' Description: Test if Hex characters of a file are present.
' Copyright: Chris Greaves Inc.
' Inputs: File handle, Character string, start position in file.
' Returns: TRUE if match is made.
' Assumes: None.
' Side Effects: None.
' Tested: By the calls shown below.

Dim lngstart As Long
If IsNumeric(locStart) Then
lngstart = locStart
If VarType(locStart) = vbString Then
lngstart = lngHexToLong(locStart)
MsgBox "boolChar wrong type " & locStart
End If
End If

Dim intLength As Integer
intLength = Len(strText) / 2
Dim strChars As String
Seek intFile, lngstart + 1
strChars = Input(intLength, intFile)
Dim strParamChars As String
strParamChars = strHexToChar(strText)
boolHex = (strChars = strParamChars)
' We need to interpret the character strings as hexadecimal digits.
'Sub TESTboolHex()
'Dim intFile As Integer
'intFile = FreeFile
'Open "i:greavestrainingwordpr~1wp51Maths.w51" For Binary As intFile
'MsgBox boolHex(intFile, "575043", 1) ' true
'MsgBox boolHex(intFile, "575043", "01") ' true
'MsgBox boolHex(intFile, "575043", "02") ' false
'Close intFile
'End Sub
End Function