home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP24.EXE / CHP2405.PRG < prev    next >
Encoding:
Text File  |  1991-04-30  |  845 b   |  39 lines

  1. /*
  2.    Listing 24.5  WriteLog()
  3.    Author: Joe Booth
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9. */
  10.  
  11. #include "FILEIO.CH"
  12.  
  13. function writelog(cUserid,cMessage)
  14. LOCAL fh,buf,retval:=.T.
  15. if file("USER.LOG")
  16.    fh:= Fopen("USER.LOG",FO_WRITE)
  17.    if fh >-1
  18.       Fseek(fh,0,FS_END)       // Move to end of file
  19.    else
  20.       retval:=.F.
  21.    endif
  22. else
  23.    fh := Fcreate("USER.LOG",FC_NORMAL)
  24. endif
  25. if fh >-1
  26.    buf := cUserid +" "+ ;
  27.           dtoc( date() )+" "+;
  28.           time()+" "+cMessage
  29.    if Fwrite(fh,buf,len(buf)) <> len(buf)
  30.       retval :=.f.
  31.    endif
  32.    Fclose(fh)
  33. else
  34.    retval:=.F.
  35. endif
  36. return retval
  37.  
  38. // end of file CHP2405.PRG
  39.