[fpc-pascal] replace one field of a record in a collection...

Sven Barth pascaldragon at googlemail.com
Fri Feb 3 11:07:22 CET 2012


Am 02.02.2012 21:22, schrieb waldo kitty:
> On 2/1/2012 17:13, Sven Barth wrote:
>> Are you storing pointers to records in your collection? If so then
>> just replace
>> the field's value. The change will then be immediately visible for
>> every other
>> code part that holds a reference to this record.
>
> thanks for your reply, sven... you've been a big help with your
> responses to my questions...
>
> in answer to your question, yes... the collections are storing pointers
> to the records and the records are also pointers to the data (i
> think!)... i'm using this line to replace the data in the collection
> with the new data if they are not already the same...
>
> PSCRec(aSatCatColl^.At(idx))^.satname^ := asatname;
>
> the data is changing but i'm suspecting that i need to be doing
> something more because with the above line in place, i'm getting a lot
> of errors like the following... i suspect the problem is that the data
> being replaced is a different length that the replacement data?? if i
> comment out the above line, my program runs with no errors at all...

What is satname? A pointer to a ShortString or a pointer to a 
AnsiString? Did some other part of your code catch (and cache ^^) a 
reference to that string?

Regards,
Sven




More information about the fpc-pascal mailing list