Sorry, that was just an example, no the types are completely different, I should have made this clear.
I’m not too good with pointers, but would the code below be correct for the implementation.
function LoadTemplate(Path: String): Pointer; var Stream: TFileStream; Data: array[0..43450] of char; begin Stream := nil; FillChar(Data, Sizeof(Data), #00);
Stream := TFileStream.Create(Path, fmOpenRead or fmShareDenyWrite); Stream.Position := 0; Stream.Read(Data, Stream.Size);
ClearStyle(Result); ShowMessage(strCantReadDat + MyStylesPath + strExists);
Result := @Data; Stream.Free; end;
and use it like:
MyTemplate := TTemplate(LoadTemplate(Path)^);
As I said this may not be correct, but Ive never really used pointers before.
Jason
-----Original
Message-----
I don't like the sound of using the path as an indicator of how the data is to be interpreted. A better solution would be to pass in a third parameter which defines the way the data is to be interpreted, i.e., the record to use.
By the way, depending on how much control you have over the data, I would really try to do away with one of the records, since. after all, they describe the same same information, just in a different order. Is this really necessary?
-Andreas
|
- [DUG]: Resume Next in Delphi Traci Sumpter
- Re: [DUG]: Resume Next in Delphi Neven MacEwan
- Re: [DUG]: Resume Next in Delphi Chris Reynolds
- Re: [DUG]: Resume Next in Delphi Laurie Bisman
- Re: [DUG]: Resume Next in Delphi Dennis Chuah
- RE: [DUG]: Resume Next in Delphi Andreas Toth
- RE: [DUG]: Load different types from one procedure? Andreas Toth
- Re: [DUG]: Load different types from one procedure? Paul McKenzie
- RE: [DUG]: Load different types from one procedure? Mark Taylor
- Re: [DUG]: Load different types from one procedure? Neven MacEwan
- Re: RE: [DUG]: Load different types from one procedure? Jason Coley