Skip to content

File_GetLineString

Read a line in a file

File_GetLineString(sFile, iLineNumber, bMustExist) As Boolean

Filename

Line number. The first line in the file is line 1.

Line must exist

Result will be stored in gsValue. The function returns False if the line doesn’t exist and bMustExist is True.

  • 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.
If bStatus Then bStatus = File_GetLineString("C:\CapaInstaller.txt", 1, True)
bStatus = Job_Writelog("Custom", "First line in CapaInstaller.txt: " & gsValue, bStatus, True)

Scripting Guidelines

File_AppendToFile File_FindInFile File_InsertInFile Constants Package Property Variables