|
![](/i/fill.gif) |
Thanks guys. Your 'clue' solved the problem.......
An errant comma was not deleted at EOF so.....
Sometimes the error messages lead one to look in the wrong place !!
David
"Margus Ramst" <mar### [at] peak edu ee> wrote in message
news:3aa4d98f$1@news.povray.org...
> "David Vincent-Jones" <geo### [at] galaxynet com> wrote:
>
> > Can somebody explain to me why the following code is halting at the
second
> > read.
>
> As far as I can see, what happens is your second loop reads the last entry
> in Build.dat - but it does not close the file, because POV closes the file
> when it reads EOF. So the condition of the first while loop is still
> satisfied; the loop starts, the first #read reads EOF and closes the file.
> After this NB_File is undefined and the second #read gives an error.
>
> Here's a hack that works around the problem; it checks whether NB_File
> is still defined after the first #read; if not, it simply runs an empty
loop.
>
> #fopen NB_File "Build.dat" read
> #while (defined(NB_File))
> #read (NB_File,Num)
> #if(defined(NB_File))
> #read (NB_File,Elev)
> prism{
> linear_sweep linear_spline
> (Elev+5),(Elev+30)
> Num
> #local i=0;
> #while (i<Num)
> #read (NB_File, Vec)
> Vec
> #local i=i+1;
> #end
> pigment {rgb x}
> }
> #end
> #end
>
> --
> Margus Ramst
>
> Personal e-mail: mar### [at] peak edu ee
> TAG (Team Assistance Group) e-mail: mar### [at] tag povray org
> Home page http://www.hot.ee/margusrt
Post a reply to this message
|
![](/i/fill.gif) |