providencia has asked for the wisdom of the Perl Monks concerning the following question:
I have this code:
#opening the logfile to check for logout
open (CHECKLOGOUT, "/$username/perl/lrnprl.log") || die "\nCouldn't open file to check for logout status\n";
#the code that checks the "end of file" (eof) for the character "#"
#and "if" the file ends with "#"
#it....
#1) clears the screen
#2) prints the exit message
#3) closes the filehandle
#4) exits the program.
if (eof("#")){
system ("cls");
print "\n\n\n\n\n\n\t\tEXITING PROGRAM IMMEDIATELY\n\n\n\t\t !!YOU MUST FIRST LOGOUT!!\n\n\n\n\n\n";
close (CHECKLOGOUT);
exit 0;
}
This will exit the program no matter what! I think I can do this with eof(). A friend showed me some code using seek() and read(). I want to use eof() because I'm stubborn. Any help is appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading the last character of a file and/or line.
by btrott (Parson) on Apr 07, 2000 at 04:51 UTC | |
|
Re: Reading the last character of a file and/or line.
by providencia (Pilgrim) on Apr 07, 2000 at 06:57 UTC |