Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to delete first n lines from a logfile ??
Message
 
To
01/03/2006 08:59:13
Albert Beermann
Piepenbrock Service Gmbh & Cokg
Osnabrück, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
MySQL
Miscellaneous
Thread ID:
01100361
Message ID:
01100385
Views:
13
lcstring=FILETOSTR(filename)
if OCCURS(CHR(13)+CHR(10),lcstring)>5000
     =strtofile(substr(lcstring, at(CHR(13)+CHR(10),lcstring,1000)+2,filename)
endif
>Hello Everbody
>I create logfile entrys with a routine like this
>
> lsErrorLog = "c:\mylog.Log"
> lhErrorLog = FOPEN(lsErrorLog, 12)
>
> * create if not there
> IF lhErrorLog < 0
> lhErrorLog = FCREATE(lsErrorLog)
> ENDIF
>
>
> = FSEEK(lhErrorLog, 0, 2)
> = FPUTS(lhErrorLog, "Datum : " + DTOC(DATE()) + " " + TIME())
> = FPUTS(lhErrorLog, "Message : " + STR(tnError, 5) + " " + tsMessage)
> = FPUTS(lhErrorLog, "Line : " + STR(tnLine, 5) + " " + tsLine)
> = FPUTS(lhErrorLog, "Rechner : " + sys(0))
> = FPUTS(lhErrorLog, "*******************************************************" )
> = FPUTS(lhErrorLog, "")
>
> * close
> IF lhErrorLog >=0
> = FCLOSE(lhErrorLog)
> ENDIF
>
>Now i want to delete the first 1000 lines from mylog.log when mylog.log has more then
>5000 lines.
>
>Can someone show me how to code this ??
>
>Best regards
>Albert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform