|
Post by iamdenteddisk on Mar 20, 2020 7:55:24 GMT 1
hi all I'm new here on the forum and new to bacon, asking how to compare strings in an array to strings in a text file to test if they exist in the file? i seen the open file example on doing it with numbers but haven't found any examples of doing it with strings. any help would be appreciated.
|
|
|
Post by Pjot on Mar 20, 2020 17:54:41 GMT 1
Hi iamdenteddisk,
How about this:
DECLARE lst$[5]
lst$[0] = "debug" lst$[1] = "with" lst$[2] = "main" lst$[3] = "configured" lst$[4] = "mmx"
OPEN "options.txt" FOR READING AS myfile
FOR i = 0 TO 4 location = SEARCH(myfile, lst$[i])
IF location >= 0 THEN PRINT "Term ", lst$[i], " found at location: ", location NEXT
CLOSE FILE myfile
BR Peter
|
|
|
Post by iamdenteddisk on Mar 21, 2020 5:12:43 GMT 1
that's perfect Pjot, thank you! implimented and working perfectly..
|
|