home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 24.5 WriteLog()
- Author: Joe Booth
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- #include "FILEIO.CH"
-
- function writelog(cUserid,cMessage)
- LOCAL fh,buf,retval:=.T.
- if file("USER.LOG")
- fh:= Fopen("USER.LOG",FO_WRITE)
- if fh >-1
- Fseek(fh,0,FS_END) // Move to end of file
- else
- retval:=.F.
- endif
- else
- fh := Fcreate("USER.LOG",FC_NORMAL)
- endif
- if fh >-1
- buf := cUserid +" "+ ;
- dtoc( date() )+" "+;
- time()+" "+cMessage
- if Fwrite(fh,buf,len(buf)) <> len(buf)
- retval :=.f.
- endif
- Fclose(fh)
- else
- retval:=.F.
- endif
- return retval
-
- // end of file CHP2405.PRG
-