a c program to print last n lines if the text as well as n is specified in the program.
the following program reads a file from BOF to EOF. I am looking for a program for reading from EOF to the number of lines i specify.i Can reach the end of file by using FSEEK() how do i read the lines.
STORE FOPEN('test.txt') TO gnFileHandle && Open the file
STORE FSEEK(gnFileHandle, 0, 2) TO gnEnd && Move pointer to EOF
STORE FSEEK(gnFileHandle, 0) TO gnTop && Move pointer to BOF
IF gnEnd <= 0 && Is file empty?
WAIT WINDOW 'This file is empty!' NOWAIT
ELSE && If not
gcString = FGETS(gnFileHandle, gnEnd) && Store contents
? gcString
ENDIF
= FCLOSE(gnFileHandle) && Close the file
