Find Marker String in Binary File

Or this:

Var fileStream as BinaryStream
Var fileData as String
Var marker as String
Var mStart as Integer
Var result as String

if f <> Nil and f.Exists then
   fileStream = BinaryStream.Open(f)
   fileData = fileStream.Read(f.Length)
   fileStream.Close   // not technically needed, it will be closed automatically at the end of the method

   marker = "VersionIsHere"
   mStart = fileData.IndexOfBytes(marker)
   if mStart >= 0 then
      Var fieldStart As Integer = mStart + marker.Bytes
      Var nullPos As Integer = fileData.IndexOfBytes(fieldStart, String.ChrByte(0))
      if nullPos >= 0 then
          result = fileData.MiddleBytes(fieldStart, nullPos - fieldStart)
          Return result
      end if
   End If
End If