Example - Seek Function

If you don't define a specific file path, the default location that PC-DMIS searches for the file to open is "C:\Users\Public\Documents\Hexagon\PC-DMIS\<version>".

' Suppose you have a file test.txt inside a d:\temp directory, containing this text: "This is a test. Only a test."
' This example cycles through the Line of text and returns the character positions of each period.
' Using the example file, it returns positions 17 and 30.
 
Sub Main()
   Dim myFile As String
   myFile = "d:\temp\test.txt"
   MsgBox "Reading " & myFile & " for searching."
   Open myFile For Input As #1
   Do While Not EOF(1)
      myChar = Input (1,#1)
      ' MsgBox myStr
      myLocation = Seek (1)
      If myChar = "." Then
         MsgBox "Found a " & myChar & " at location " & myLocation
      End If
   Loop
   Close 1
End Sub