ph2003
10-20-2011, 12:23 AM
hi all,
how to read only last line of a log file?
because the log is always updating in realtime.
if i do a loop reading full log every time.
it gets slower and slower when the file get larger :(
currently im using this code to do loop for reading:
string $machineProcess = ("c:/process.log");
int $filelogid = ` fopen $machineProcess "r" ` ;
string $nextLine = ` fgetline $filelogid `;
while (size($nextLine) > 0) {
$nextLine = ` fgetline $filelogid `;
}
fclose $filelogid;
thanks in advances!
how to read only last line of a log file?
because the log is always updating in realtime.
if i do a loop reading full log every time.
it gets slower and slower when the file get larger :(
currently im using this code to do loop for reading:
string $machineProcess = ("c:/process.log");
int $filelogid = ` fopen $machineProcess "r" ` ;
string $nextLine = ` fgetline $filelogid `;
while (size($nextLine) > 0) {
$nextLine = ` fgetline $filelogid `;
}
fclose $filelogid;
thanks in advances!
