07-10-2009, 02:31 AM
hy, i am trying to make a small database to practice, but i like to save a record in a file. for adding more file in the next time to open. my situation is that i used the free file to start in the next free record when add more record , but the new record delete the old record, not entire the file.
was is the best approach to make a file appendable and situable for a database, to editable the file and also, add more record.
thanks in advanced.
Code:
CLS
TYPE namestype
  nm AS STRING * 10
  ln AS STRING * 10
  age AS INTEGER
END TYPE
DIM names AS namestype
DIM fh AS INTEGER
fh = FREEFILE
recordlen# = LEN(names)
OPEN "stubase.dat" FOR RANDOM AS #fh LEN = recordlen#
5
INPUT "name: ", names.nm
INPUT "last name: ", names.ln
INPUT "age:", names.age
PUT #fh, , names
INPUT "any more data?", more$
   IF more$ = "y" GOTO 5 ELSE
CLOSE #fh
END
was is the best approach to make a file appendable and situable for a database, to editable the file and also, add more record.
thanks in advanced.