FileGrep
InstallShield 2024 » InstallScript Language Reference
The FileGrep function searches a text file for a specified string. If the string is found, the line containing that string is returned in svReturnLine and the number of the line is returned in nvLineNumber. The search is not case-sensitive. FileGrep works on line-oriented text files; it will not work with binary files.
Note:It is not necessary to open a file before searching it with FileGrep; nor do you need to close it after the call to FileGrep. File open and file close are performed automatically by FileGrep. Although FileGrep will perform successfully in most cases on a file that is already open as a result of a previous call to OpenFile, it will return FILE_NOT_FOUND if the file was opened in append mode.
Syntax
FileGrep ( szFileName, szSearchStr, svReturnLine, nvLineNumber, nFlag );
Parameters
Parameter |
Description |
||||||
szFileName |
Specifies the fully qualified name of the file to search. |
||||||
szSearchStr |
Specifies the search string. |
||||||
svReturnLine |
Returns the line in which szSearchStr was found. |
||||||
nvLineNumber |
Return the number of the line in which szSearchStr was found. Line numbering starts at 0. |
||||||
nFlag |
Specifies search options. Pass one of the following predefined constants in this parameter:
|
Return Values
Return Value |
Description |
||||||||||||
0 |
FileGrep found the specified string. |
||||||||||||
< 0 |
FileGrep failed because of one of the following conditions:
|
See Also