File_GetLineString
Description
Section titled “Description”Read a line in a file
Syntax
Section titled “Syntax”File_GetLineString(sFile, iLineNumber, bMustExist) As Boolean
Parameters
Section titled “Parameters”sFile (String)
Section titled “sFile (String)”Filename
iLineNumber (Integer)
Section titled “iLineNumber (Integer)”Line number. The first line in the file is line 1.
bMustExist (Boolean)
Section titled “bMustExist (Boolean)”Line must exist
Return value
Section titled “Return value”Result will be stored in gsValue. The function returns False if the line doesn’t exist and bMustExist is True.
Remarks
Section titled “Remarks”- The file must exist. If it doesn’t, the function returns False, whatever the value of bMustExist.
- If the line doesn’t exist and bMustExist is False, gsValue isn’t changed. It keeps the value from an earlier function call. Set gsValue to
""before the call if you need to detect this. - The file is read as ANSI text. See Text file encoding.
Example
Section titled “Example”If bStatus Then bStatus = File_GetLineString("C:\CapaInstaller.txt", 1, True)bStatus = Job_Writelog("Custom", "First line in CapaInstaller.txt: " & gsValue, bStatus, True)Related functions
Section titled “Related functions”File_AppendToFile File_FindInFile File_InsertInFile Constants Package Property Variables