saving a records containing a member of type string to a file (Delphi, Windows)

Posted by wonderer on Stack Overflow See other posts from Stack Overflow or by wonderer
Published on 2009-09-24T15:08:57Z Indexed on 2010/03/15 1:09 UTC
Read the original article Hit count: 252

Filed under:
|
|
|
|

I have a record that looks similar to:

type
  TNote = record
    Title : string;
    Note  : string;
    Index : integer;
  end;

Simple. The reason I chose to set the variables as string (as opposed to an array of chars) is that I have no idea how long those strings are going to be. They can be 1 char long, 200 or 2000. Of course when I try to save the record to a type file (file of...) the compiler complains that I have to give a size to string. Is there a way to overcome this? or a way to save those records to an untyped file and still maintain a sort of searchable way?

Please do not point me to possible solutions, if you know the solution please post code. Thank you

© Stack Overflow or respective owner

Related posts about delphi

Related posts about Windows