*This Function couts the no of lines in a file *The file with the path is passed to the function FUNCTION COUNTLNS PARAMETERS lcFileNamePath PRIVATE lcFileNamePath, ifp_size, ifp_top IF FILE(lcFileNamePath) STORE FOPEN(lcFileNamePath) TO file_handle ELSE WAIT "Can not open file for copy chk "WINDOW ENDIF IF file_handle < 0 && Check for error opening file WAIT 'Cannot open or create output file' WINDOW NOWAIT ELSE STORE FSEEK(file_handle, 0, 2) TO ifp_size && Move pointer to EOF STORE FSEEK(file_handle, 0) TO ifp_top && Move pointer to BOF IF ifp_size <= 0 WAIT WINDOW 'This file is empty!' NOWAIT RETURN 0 ELSE && If not IF ifp_size <= 0 ifp_size = 500 ENDIF lnNoOfLines = 0 tllGo = .T. DO WHILE(tllGo) l_string = FGETS(file_handle, ifp_size) IF !EMPTY(l_string) * ? l_string lnNoOfLines = lnNoOfLines + 1 ELSE tllGo = .F. ENDIF ENDDO ENDIF = FCLOSE(file_handle) && Close the file ENDIF RETURN lnNoOfLines