Article View: alt.flame.pascal
Article #50Re: Help !!! Can't save pointer list to file
From: Hiroyuki Shimada
Date: Tue, 11 Mar 1997 00:00
Date: Tue, 11 Mar 1997 00:00
46 lines
2655 bytes
2655 bytes
Hello.
Hugo Palma <hmpalma@mail.telepac.pt> wrote in article <01bc2d75$4541e060$LocalHost@host.telepac.pt>...
> I'm doing a project,but i'm just not able to save a variable of type LIST
> as shown below.
> I'm only able to save the first segment of the list,and none of the next.
> Can anyone please help me.
> Thanks.
>
> type
> list=^no;
> no=record
> v:integer;
> seg:list;
> end;
>
> var
> p:list;
Make a new record type to save and load the data:
type
no_for_save_and_load = record { Define a record type which doesn't have }
v: integer; { the pointer field to next record. }
end;
var
f: file of no_for_save_and_load;
data: no_for_save_and_load;
begin
assign(f, 'filename.dat'); { if Delphi, assignfile() }
reset(f);
while p^.seg <> nil do begin
data.v := p^.v; { substitute all fields to the record type data }
writeln(f, data); { save }
p := p^.seg; { substitute next record }
end;
close(f); { if Delphi, closefile() }
end;
-----------------------------------------------------------------------
Mail: shimaden@annie.co.jp Home Page: http://www.annie.co.jp/~shimaden/
Hiroyuki Shimada
-----------------------------------------------------------------------
Technical Details
Message-ID:
<01bc2daa$4a0baa60$LocalHost@shimaden.vision.annie.co.jp>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<01bc2d75$4541e060$LocalHost@host.telepac.pt>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10261c,e6cf518a5140afcc X-Google-Attributes: gid10261c,public X-Google-Thread: 10c950,e6cf518a5140afcc X-Google-Attributes: gid10c950,public X-Google-Thread: ff90a,e6cf518a5140afcc X-Google-Attributes: gidff90a,public X-Google-Thread: 10baee,e6cf518a5140afcc X-Google-Attributes: gid10baee,public X-Google-Thread: 1006de,e6cf518a5140afcc X-Google-Attributes: gid1006de,public X-Google-Thread: 10eb32,e6cf518a5140afcc X-Google-Attributes: gid10eb32,public X-Google-Thread: 10a7f1,e6cf518a5140afcc X-Google-Attributes: gid10a7f1,public X-Google-Thread: 102601,e6cf518a5140afcc X-Google-Attributes: gid102601,public From: "Hiroyuki Shimada" <shimaden@annie.co.jp> Subject: Re: Help !!! Can't save pointer list to file Date: 1997/03/11 Message-ID: <01bc2daa$4a0baa60$LocalHost@shimaden.vision.annie.co.jp> X-Deja-AN: 224767386 References: <01bc2d75$4541e060$LocalHost@host.telepac.pt> Organization: S.S.A. Newsgroups: alt.flame.pascal,comp.lang.pascal.ansi-iso,comp.lang.pascal.delphi.misc,comp.lang.pascal.misc,ctdl.lang.pascal,de.comp.lang.pascal.delphi,de.comp.lang.pascal.misc,fj.lang.pascal,fr.comp.lang.pascal,maus.lang.tpascal,relcom.comp.lang.pascal,relc