Ross,

There is no need to store a pointer as a string in Delphi is a reference anyway. Behind the scenes, it is actually a pointer that points to the first byte of the string.

You cannot access the string with ^ because it is not a PString, but a string type.

Dennis.

From: "Ross Levis" <[EMAIL PROTECTED]>

Hi Dennis

Hi. If you looked at the definition of TStringItem, you will see that FString is of type string.

Yes, but I want to store a pointer to the memory location of the string. In fact, I'm storing the locations of all strings added to the stringlist. I don't want a copy of the strings as that would double memory requirements.


BTW, I still don't understand why you can't simply do stringlist.Strings[index] to get at the string.

The index will change as items are added because it's a sorted stringlist. I need access to the strings via other classes. But I also need a fast Find operation which the Stringlist provides. I hope that makes sense.


I still don't understand why I can't simply dereference the PString using a ^, which should convert it to a string.

Cheers,
Ross.

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

_________________________________________________________________ Need more speed? Get Xtra JetStream @ http://xtra.co.nz/jetstream

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to