Function will return the number of records in a FileManager object opened file by using the file's file number to access the file.

 

Syntax:

iRecordsInFile = fileManager.CountLines( iFileNumber )

 

Parameter:

Description:

iFileNumber

The opened file-number integer value returned by the FileManager's Open methods.

 

Example:

'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VARIABLES: sFullPathFileName, sPathName, sFileName   Type: String
VARIABLES: iFileNumber, iRecordsInFile               Type: Integer
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  Combine Path + "\" + File-Name into a Full Path-File statement
sFullPathFileName = sPathName + sFileName
 
'  If the file Exist, . . .
If FileExists( sFullPathFileName ) THEN
  '  Open File to obtain its File Number
  iFileNumber = fileManager.OpenRead( sFullPathFileName )
  '  If a File number is assigned, . . .
  If iFileNumber THEN
    '  Count the Records contained in the file
    iRecordsInFile = fileManager.CountLines(iFileNumber)
  ENDIF ' iFileNumber
ENDIF '  FileExists
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Returns:

Number of records contained in the file.

 

Links:

FileExists, OpenAppend, OpenRead, OpenWrite

See Also:

FileManager, File & Disk Functions

 


Edit Time: 9/21/2020 1:47:09 PM


Topic ID#: 233

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software