"Thomas P" <blomme@post.com> wrote in message
news:9gng0m$d77$1@news.inet.tele.dk...
> Hej,
>
> Jeg skal skrive to arrays af to records, der hver er af variabel længde
> (altså arrays'ene). Recordsene indeholder typer som shortstring, integer
og
> boolean. Hvilket filformat skal jeg bruge, og hvordan gør jeg det i hele
> taget ? Indtil nu, har jeg kun været i stand til at skrive til filer hvor
> typen er den samme (så kunne jeg jo bruge minfil : file of mintype).
> Anything ?
Ja, lad være med at bruge File!
Brug i stedet det abstrakte storage-interface TStream.
En defineret descendant af TStream er TFileStream, som du kan
instacsi...instensi.... lave instancer af
Gør således:
Procedure Quux;
Var
S : TFileStream;
Begin
S := TFileStream.Create('c:\config.sys',fmShareDenyWrite Or fmOpenReadWrite)
// Se hjælpen, den er meget udførlig på dette punkt [1]
S.Write(MyArray1^,MyArraySize1);
S.Position := 1234;
S.Write(MyArray2^,MyArraySize2);
S.Free;
End;
P.S: Husk at bruge en fixed-pitch font når du læser dette...
Hvis du vil høre mere, så bare skriv igen
[1]
Value Meaning
fmCreate = Create a file with the given name. If a file with the
given name exists, open the file in write mode.
If the file can not be opened, Create will raise an exception.
fmOpenRead = Open the file for reading only.
fmOpenWrite = Open the file for writing only. Writing to the file
completely replaces the current contents.
fmOpenReadWrite = Open the file to modify the current contents rather than
replace them.
The share mode must be one of the following values:
fmShareCompat = Sharing is compatible with the way FCBs are opened.
fmShareExclusive = Other applications can not open the file for any reason.
fmShareDenyWrite = Other applications can open the file for reading but not
for writing.
fmShareDenyRead = Other applications can open the file for writing but not
for reading.
fmShareDenyNone = No attempt is made to prevent other applications from rea
ding from or writing to the file.
--
Regards, Christian Iversen [FIDUSO]
Flawless.Dk: [
http://domains.flawless.dk]
Do you have a (broken?) IBM75GXP Drive?
Please go to [
http://ibm.flawless.dk]