Page 1 of 1

About flat dataBase

Posted: Thu May 24, 2012 9:34 am
by PatFr
Hi everybody
I try pour make a little db dy using this example :
`==========set it up============
record car
  wheel as integer
  color as string * 10
end record

dim dbase as randomfile
`open file this before assigning the record
dbase.open("database.txt")


`assign record
dbase.assign(car)
`===============================

`put some data
car.wheel=10
car.color="red"

`append to file
dbase.append

`==========check the results====
car.wheel=0
car.color=""

`read record 1 yuo can also write a record with put
dbase.get(1)

showmessage "found "+car.color+str$(car.wheel)
`=============================== 
Back to top   

My Question:
In database.txt, all records are in line.
How can insert a LineFeed or CR after each record to export this file ?

Thanks

About flat dataBase

Posted: Thu May 24, 2012 3:03 pm
by PatFr
Well, I find it myself:

dim CR as string
CR= chr$(13)+chr$(10) ` ChariotReturn and LineFeed

=======
record car
CR as string * 3

...
`===============================
`put some data
car.CR= CR
...


It works
Perhaps this code help someone
PatFr