POV-Ray : Newsgroups : povray.binaries.scene-files : Writing and reading files : Re: Writing and reading files Server Time
2 Sep 2024 18:15:16 EDT (-0400)
  Re: Writing and reading files  
From: Robert Chaffe
Date: 7 Jun 2000 23:05:38
Message: <393f0d82@news.povray.org>
Did some experimenting and found a solution.  Write the values to
the file separated by commas instead of line feeds.  Then the other
script reading the file works just fine.  See notes below.

rc

"Josh English" <eng### [at] spiritonecom> wrote in message
news:393C708B.F272111A@spiritone.com...
> Attached are two files. Run readlist.pov first and it generates a text
> file with the contents of an array of vectors. When I run writelist.pov
> I get a plethora of errors, mainly, on line 94:
> Attempted to redefine vector identifier as float identifier.
>
> I don't get it. I've read the docs and as far as I can see I'm doing
> everything right, if not in a round about way.
>
> Can anyone figure out what's going wrong?
>
> Thanks,
>
> Josh
>

Note that the "\n" has been replaced by "," in the write statements:

> #declare plist = array [5]
>  { <-1,0,0> <-0.5,0,0> <0,0,0> <0.5,0,0> <1,0,0> }
>
>
> #fopen MyFile "pointlist.txt" write
>
> #write (MyFile,dimension_size(plist,1),",")
>
> #declare cnt = 0;
> #while ( cnt < dimension_size(plist,1) )
>   #write (MyFile,plist[cnt],",")
>   #declare cnt = cnt + 1;
> #end
>
> #fclose MyFile
>
> PlotList(plist)

That leaves a trailing comma in the text file.  Based on the example
given that should not cause a problem.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.