Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using StLArr

0 views
Skip to first unread message

mrpcman

unread,
Dec 5, 2002, 4:55:32 AM12/5/02
to
In your docs it is said that StLArr container can be as large as system
memory allows. Is it possible to load very, very large text files or text
streams into one of these StLArr? I am trying to loadfromfile method of
StLArr class and I am receiving an error that states:
"Invalid Property Value" for the following code, could you tell me what's
wrong with it! It's very simple, I want to load a text of any size, with
each element of any length. This code example only uses a CHAR as the
element sizeof length however I want to have any length element.
Your response is greatly appreciated!
Mrpcman
here's the code:
procedure TForm1.BitBtn1Click(Sender: TObject);
var
myArray : TStLArray;
S : String;
begin
myArray := TStLArray.Create(100,SizeOf(Char));
myArray.Clear;
myArray.LoadFromFile('copyunit1.pas'); // error occurs here - 'invalid
property value'
myArray.Get(50,S);
ShowMessage('myArray[50] = '+ S);
end;


Stephen Posey [TurboPower Software]

unread,
Dec 6, 2002, 3:00:57 PM12/6/02
to

The .LoadFromFile method of the SysTools container classes isn't
designed to load arbitrary data into the container, rather it's
used to re-load data that has previously been saved using the
container's .SaveToFile method; both of which require registering
your container node type with the Delphi streaming engine (see
the section on "Stream Support" in the container class
introduction section of the manual).

To load a TStLArray with individual characters from an ordinary
text file will require iterating the file character by character
and creating and adding appropriate array nodes as needed.

Please be sure to read the introductory material on using the
SysTools container classes; then the example code in the manual
section on TStLArray and the EX1DARR.DPR, EX2DARR.DPR, and
EX3DARR.DPR example programs should get you started on using
TStLArray.

If you have troubles, please post again.

Stephen Posey [TurboPower Software]
--
Please respond to the newsgroups and not via email.
This way, everyone benefits from knowing what was said.
Replies to mails...@turbopower.com will be copied back
to the newsgroup.

0 new messages