type
TStringListForm = class(TForm)
Edit1: TEdit;
DoButton: TButton;
procedure FormCreate(Sender: TObject);
procedure DoButtonClick(Sender: TObject);
public
File1: TStringList;
FileE: TStringList;
end;
var
StringListForm: TStringListForm;
implementation
procedure TStringListForm.FormCreate(Sender: TObject);
begin
File1 := TStringList.Create;
FileE := TStringList.Create;
end;
procedure TStringListForm.DoButtonClick(Sender: TObject);
var
FileName: string;
begin
FileName := Edit1.Text;
try
File1.LoadFromFile(FileName);
FileE.CommaText := File1.Text;
finally
File1.Free;
At this point if I look at File1.Count before freeing the return is the
number of records in the comma delimited file. If I look at FileE.Count the
return is a partial number of record items. Each record has 87 items of
data and the delimited file can have as many as 800 records. This relates to
approx. 70,000 items per file. The number returned for FileE.Count is
typically between 915 and 930. I have tried this same code on other
computers with larger memory with no difference in the outcome for
FileE.Count. The capacity for a StringList is much larger than what I am
using so how come I don't get all the items loaded into FileE?
Thanks for your help.
Ted Hall
T_...@msn.com or t...@thoracingnet.com
Ted,
i think there was a little bug in D2's CommaText implementation regarding
large input strings, if i remember correctly. Instead of trying to parse the
complete file at once do it record by record
File1.LoadFromFile(FileName);
for i:= 0 To File1.count-1 do begin
FileE.CommaText := File1[i];
...process the fields for this record
end;
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitely requested!