About flat dataBase

In this category you can exchange your programming questions and solutions.
Post Reply
PatFr
Posts: 2
Joined: Thu May 24, 2012 9:23 am

About flat dataBase

Post: # 878Post PatFr
Thu May 24, 2012 9:34 am

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

PatFr
Posts: 2
Joined: Thu May 24, 2012 9:23 am

About flat dataBase

Post: # 879Post PatFr
Thu May 24, 2012 3:03 pm

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




Post Reply