Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!mstar!westfort!dragon From: dragon@westfort.UUCP (The Mystic) Newsgroups: comp.lang.pascal Subject: Re: Pointers.. Message-ID: <3398@westfort.UUCP> Date: 15 May 89 20:34:33 GMT Reply-To: westfort!dragon@tut.cis.ohio-state.edu Organization: Outside the Asylum at the Western Fortress Lines: 51 I managed to get pointers working w/ files, yet for some reason when I come back to the file, it's all garbage.. I realize that the pointers were for memory vars only, but this program created a disk file as I specified in my assign command.. Perhaps an example.. Program testheap; uses dos,crt; Type boardtype=^boardrec; boardrec=record name:string[20]; age:integer; end; Var msgbase:boardtype; messagebase:file of boardtype; procedure getest; begin clrscr; write('Enter Your Name: '); readln(msgbase^.name); write('Enter Your Age.: '); readln(msgbase^.age); assign(messagebase,'c:\pascal\testfile.dat'); {$I-} reset(messagebase); {$I+} if ioresult<>0 then rewrite(messagebase); write(messagebase,msgbase); close(messagebase); end; procedure readtest; begin assign(messagebase,'c:\pascal\testfile.dat'); writeln; {$I-} reset(messagebase); {$I+} if ioresult<>0 then rewrite(messagebase); read(messagebase,msgbase); with msgbase^ do begin writeln('Your name is: ',name); writeln('Your Age is.: ',age); delay(5000); close(messagebase); end; end; begin getest; readtest; end. If I take out the getest from the routine, after I've run other programs, it brings up garbage... Why?