|
-
November 28th, 2002, 12:40 AM
#1
Need Code for these
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
Last edited by Amandeep; November 29th, 2002 at 04:41 AM.
Regards,
Aman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|