| View previous topic :: View next topic |
| Author |
Message |
Greg Stantin Guest
|
Posted: Thu Apr 29, 2004 8:52 pm Post subject: One more for delphi to bcb |
|
|
I am stuck on this one.
Data := THttpDirEntry(FileList.Objects[I]);
Data = THttpDirEntry(DirList->Objects[I]);
But i get
[C++ Error] WebServ1.cpp(500): E2285 Could
not find a match for 'THttpDirEntry::THttpDirEntry(TObject *)'
I am assuming my translation is incorrect.
Is this line correct.
FileList.Objects[I].Free;
delete(FileList->Objects[I]);
Thanks
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Thu Apr 29, 2004 9:15 pm Post subject: Re: One more for delphi to bcb |
|
|
Greg Stantin wrote:
| Quote: | Data := THttpDirEntry(FileList.Objects[I]);
Data = THttpDirEntry(DirList->Objects[I]);
But i get
[C++ Error] WebServ1.cpp(500): E2285 Could
not find a match for 'THttpDirEntry::THttpDirEntry(TObject *)'
|
Please provide the type of the used 'DirList' too.
Why not keep with a 'FileList' ? What would be that type ?
Hans.
|
|
| Back to top |
|
 |
Greg Stantin Guest
|
Posted: Thu Apr 29, 2004 9:31 pm Post subject: Re: One more for delphi to bcb |
|
|
I pasted the wrong code, there are actually two TStringList
that does the stuff. Tell me if this helps.
Data : THttpDirEntry;
DirList := TStringList.Create;
// file name
DirList.AddObject(Data.Name, Data)
----snip--------
if Total <= 0 then
//Result := Result +'
Result := Result
else begin
for I := 0 to DirList.Count - 1 do begin
Data := THttpDirEntry(DirList.Objects[I]);
Result := Result + '<tr>' + FormatDirEntry(Data) + '</tr>' +
#13#10;
DirList.Objects[I].Free;
end;
DirList.Free;
// I just need this line
Data = THttpDirEntry(DirList->Objects[I]);
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Apr 29, 2004 9:57 pm Post subject: Re: One more for delphi to bcb |
|
|
"Greg Stantin" <gstantin (AT) stantonassoc (DOT) com> wrote
| Quote: | I am stuck on this one.
Data := THttpDirEntry(FileList.Objects[I]);
|
Data = (THttpDirEntry*)(FileList->Objects[I]);
Or:
Data = static_cast<THttpDirEntry*>(FileList->Objects[I]);
| Quote: | Is this line correct.
FileList.Objects[I].Free;
delete(FileList->Objects[I]);
|
You don't need the paranthesis:
delete FileList->Objects[I];
Also, assuming THttpDirEntry derives from TObject, then yes, it will work.
Otherwise, you will have to cast:
delete (THttpDirEntry*)(FileList->Objects[I]);
Or:
delete static_cast<THttpDirEntry*>(FileList->Objects[I]);
Gambit
|
|
| Back to top |
|
 |
Greg Stantin Guest
|
Posted: Thu Apr 29, 2004 10:43 pm Post subject: Re: One more for delphi to bcb |
|
|
| Quote: | Data = (THttpDirEntry*)(FileList->Objects[I]);
|
That was it. I am still looking for a reference list that shows some
of the delphi to bcb syntax. I saw a list somewhere before, but
i could never remember where.
Appreciate the help Gambit.
Greg
|
|
| Back to top |
|
 |
|