Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-09

Persistent lists to save records

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

luciano de souza

Hello all,

Sometimes, I want only to save a simple file of records. The first approach is record files, handled with reset, read, write and close of CRT unit.

However, thereis an important limit. Strings can't exceed 255 characters. The $H switch can't be on.

So my question is: which are the easiest way to save records without this limitation?

Is there something like a persistent list?

Luciano de Souza

Reply by email

leledumbo
to luciano de souza
So my question is: which are the easiest way to save records without this

limitation?

Is there something like a persistent list?

Not with static data record. That one do only support shortstrings, because it contains actual data. Other strings are just pointers, which will be saved as pointers as well, thus cannot be used for things like this. For dynamic data, you have to work a little harder by using untyped file. Dynamic data can easily be represented as length followed by data. Length can be 1-n bytes, depending the maximum length of data you want to support.

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Persistent-lists-to-save-records-tp5720142p5720144.html Sent from the Free Pascal - General mailing list .

Reply by email

luciano de souza
to leledumbo

Hum... It's a very good idea. Firstly, I thought in something like a persistent list with LoadFromFile and SaveTofile methods, but this approach is really simple and useful.

2014-09-22 13:01 GMT-03:00, leledumbo :

Show quoted text 21 lines
> So my question is: which are the easiest way to save records without this limitation? > Is there something like a persistent list? Not with static data record. That one do only support shortstrings, because it contains actual data. Other strings are just pointers, which will be saved as pointers as well, thus cannot be used for things like this. For dynamic data, you have to work a little harder by using untyped file. Dynamic data can easily be represented as length followed by data. Length can be 1-n bytes, depending the maximum length of data you want to support. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Persistent-lists-to-save-records-tp5720142p5720144.html Sent from the Free Pascal - General mailing list . _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Luciano de Souza

Reply by email