Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!kddlab!icot32!nttlab!gama!etlcom!titcca!sragwa!wsgw!socslgw!diamond!diamond From: diamond@diamond.csl.sony.junet (Norman Diamond) Newsgroups: comp.lang.pascal Subject: Re: Pointers.. Message-ID: <10309@socslgw.csl.sony.JUNET> Date: 31 May 89 03:29:30 GMT References: <3398@westfort.UUCP> Sender: news@csl.sony.JUNET Reply-To: diamond@csl.sony.junet (Norman Diamond) Organization: Sony Computer Science Laboratory Inc., Tokyo, Japan Lines: 26 In article <3398@westfort.UUCP> westfort!dragon@tut.cis.ohio-state.edu writes: > 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.. When a program terminates, its variables lose their values. This includes variables named in the programs, and variables created by "new". When you write a variable to a file, its value stays there and the value can be read back later. You did not write any variables of type "boardtype", so there were no names or ages in the file. You only wrote pointer variables, so there were only addresses. Your second execution of the program did not create the same exact boardtype variables with "new". Your first execution must write variables of type "boardtype", and your second execution must create the variables again (calling "new") and read in the "boardtype" variables, in order to remember names and ages. -- Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.co.jp@relay.cs.net) The above opinions are my own. | Why are programmers criticized for If they're also your opinions, | re-implementing the wheel, when car you're infringing my copyright. | manufacturers are praised for it?