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" [b]FOR APPEND[/b] 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)
    [b]nRecs = LOF(hFile) \ SIZEOF(R)[/b] ' how many records in file now?
    R.Checkno  = whatever
    R.Payee    = whatever
    R.Amt      = whatever
    [b]INCR nRecs[/b]  ' 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 (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment

    Working...
    X