10-23-2006 10:54 PM
10-24-2006 02:04 AM
10-24-2006 02:14 AM
Hello,
I think you forgot to attach the file ![]()
You could use the function ReadLine to read lines from your file, and then use Findpattern to search for the variable you are looking for. This piece of code counts the occurrence of the word "var" in the file:
num_variables = 0;
nr_of_readbytes = 0;
while ((num_bytes = ReadLine (filehandle, line_str, MAX_STRING_LEN)) >= 0){
// Search for variable "var" in the line.
if (num_bytes > 0){
variable_position = -1;
do{
variable_position = FindPattern (line_str, variable_position+1, -1, "var", 1, 0);
if (variable_position >= 0)
num_variables++;
} while (variable_position >= 0);
}
}
CloseFile (filehandle);
// Check if an error occurred while reading from the file
if (num_bytes == -1 && (error = GetFmtIOError ()))
MessagePopup ("Error while reading from file", GetFmtIOErrorString (error));
10-24-2006 02:16 AM
(..)loop until not end of file(...)
Obviously this is a mistake: either loop while not end of file or loop until end of file ![]()
10-26-2006 12:30 PM
10-26-2006 06:53 PM