Vicon Shogun banner

Description

This command can be used to search within a text file for a specified string. It returns a Boolean value to indicate whether the search was successful or not.

It can be used for custom File I/O scripts.

This command can only be run on a file that is already open using fileOpen in Read mode. If the file has not been opened with readable flags then seekToString will fail.

Functional area

Disk I/O

Command syntax

Syntax

seekToString fileID "searchString"

Arguments

NameTypeRequiredComments
searchStringstringyesString to search for
fileIDintyesID of file previously opened with fileOpen

Flags

None

Return value

boolean

Examples

//set search string
string $str = "zb";
int $fileID;
boolean $StringExists;

//open file for reading
int $fileID = `fileOpen "C:/myfile.txt" "r"`;

//search for string
$StringExists = `seekToString $fileID $str`;

//print true or false to log
print $StringExists;

//close file
fileClose $fileID;

Additional information

Related commands