Announcement

Collapse
No announcement yet.

appending files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • appending files

    I am writing my own checking program. The major problem I have is
    saving the amount of the check or deposit, so that it would be added
    to the file to show the balance the next time the file is opened. Does
    anyone know where there is a snippet of code that I can view that will
    assist me in solving this problem.

    Thanks

    ------------------

  • #2
    If the file is accessed sequentially (e.g., a comma-separate values file)

    Code:
    OPEN "THEFILE" FOR APPEND AS #hFile
    WRITE #hFile, CheckNo, Payee, Amt, NewBalance
    CLOSE hFile
    If the file is to be accessed RANDOM
    Code:
    DIM R AS RecordUDT
    OPEN "THEFILE" FOR RANDOM AS hFile LEN=SIZEOF(R)
    nRecs = LOF(hFile) \ SIZEOF(R) ' how many records in file now?
    R.Checkno  = whatever
    R.Payee    = whatever
    R.Amt      = whatever
    INCR nRecs  ' add at end
    PUT #hFile, nRecs, R
    CLOSE hFIle
    MCM



    [This message has been edited by Michael Mattias (edited February 20, 2003).]
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment

    Working...
    X