POV-Ray : Newsgroups : povray.binaries.scene-files : Writing and reading files Server Time
2 Sep 2024 16:16:37 EDT (-0400)
  Writing and reading files (Message 1 to 4 of 4)  
From: Josh English
Subject: Writing and reading files
Date: 5 Jun 2000 23:31:07
Message: <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


Post a reply to this message


Attachments:
Download 'us-ascii' (3 KB) Download 'us-ascii' (2 KB)

From: Jerome
Subject: Re: Writing and reading files
Date: 6 Jun 2000 07:27:32
Message: <393CE024.FCCE947E@iname.com>
Josh English wrote:
> 
> 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
>
> #while ( cnt < dimension_size(tlist,1) )
>   #declare MuVect = <0,0,0>;
>   #read (MyFile,MyVect)
>   #declare tlist[cnt] = MyVect;
	I don't know if that's the problem, but shouldn't the
#declare be for MyVect instead of MuVect?

		Jerome
-- 

* Doctor Jekyll had something * mailto:ber### [at] inamecom
* to Hyde...                  * http://www.enst.fr/~jberger
*******************************


Post a reply to this message

From: Josh English
Subject: Re: Writing and reading files
Date: 6 Jun 2000 11:34:53
Message: <393D1A5F.5635D61F@spiritone.com>
hmmm.... probably. That is a sad typo that I am justly famous for. But even
without that line it fails. In the first loop of ReadList.pov I have
commented out the #read (MyFile,tlist[cnt]) because it gave me similar
errors. It seems that POV is reading the file and reading the first portion
of the vector as a float variable, then ignoring the rest of that line.

Josh

Jerome wrote:

> Josh English wrote:
> >
> > 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
> >
> > #while ( cnt < dimension_size(tlist,1) )
> >   #declare MuVect = <0,0,0>;
> >   #read (MyFile,MyVect)
> >   #declare tlist[cnt] = MyVect;
>         I don't know if that's the problem, but shouldn't the
> #declare be for MyVect instead of MuVect?
>
>                 Jerome
> --

> * Doctor Jekyll had something * mailto:ber### [at] inamecom
> * to Hyde...                  * http://www.enst.fr/~jberger
> *******************************

--
Josh English
eng### [at] spiritonecom
"May your hopes, dreams, and plans not be destroyed by a few zeros."


Post a reply to this message

From: Robert Chaffe
Subject: Re: Writing and reading files
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.