This is how append to Log files in UV: some of the log files get to be many hundreds of megabytes and this is still fast:

%< -----------------------------
               subroutine APPEND.UNIX(NEW.LINE, PATH, ERR)

  ERR = ''  ;*  Return this if nothing goes wrong
openseq PATH to SEQFILE else null ;* This does not fail if it's not there...

  * But this DOES fail if it's not there:
  status STAT from SEQFILE else  ;* CREATE IT if it's not there...
    * Use WEOFSEQ to create it:
    weofseq SEQFILE on error
      ERR = 'Unable to WEOFSEQ ':PATH
      return
    end
  end

  OFFSET = 0   ;*  No offset
  RELTO  = 2   ;*  Relative to the end of the file
  seek SEQFILE, OFFSET, RELTO else
    ERR = 'Unable to SEEK on ':PATH
    return
  end
  * We could also write binary data this way ?:
  * WRITEBLK CONTENTS TO SEQFILE ELSE

  writeseqf NEW.LINE to SEQFILE else
    ERR = 'Unable to WRITESEQF on ':PATH
    return
  end

  closeseq SEQFILE

( I subscribe only to the digest so 'cc' me on any replies ? ...)

- JimA
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to