POV-Ray : Newsgroups : povray.general : #read fiasco : Re: #read fiasco Server Time
11 Aug 2024 15:20:54 EDT (-0400)
  Re: #read fiasco  
From: Greg M  Johnson
Date: 9 Aug 1999 10:18:01
Message: <37AEE28B.4228E453@geocities.com>
One more comment:  I am pretty sure the error message said something about an
unexpected PRESENCE of a comma; my problem was ultimately the
unexpected ABSENCE of a comma. I think if I had seen a different message, I would have
fixed the problem in a matter of minutes.

Is the error message stream correct?

Greg M. Johnson wrote:

> I wish that the documentation better explained the syntax for #read and
> #write.
>
> I have created a file of the positions and velocities of a number of
> particles, (34 particles at 350 time periods).  I have pasted the first
> four records from my file.
>
> 0,0,2.82488,1.88872,1.28931,-0.528847,-0.0413402,-0.84771
> 0,1,4.52083,2,3.26511,0.180401,-0.87059,-0.457743
> 0,2,2.46931,-1.21869,-0.8285,-0.187654,-0.372504,-0.90886
> 0,3,-2.75538,0.609548,-1.23555,-0.440196,-0.39602,-0.805851
>
> The text file has the carriage returns already in it, as you can see. I
> successfully used the following command to write this file:
>
> #write
>
(MyFile2,tt,",",n,",",actorp[n][0].x,",",actorp[n][0].y,",",actorp[n][0].z,",",actorv[n][0].x,",",actorv[n][0].y,",",actorv[n][0].z,"\n"
>
> )
>
> But when I try to read the file, either superpatch for 3.1a crashes, or
> it says something about expecting a variable but seeing a comma
> instead.  I want to load this huge file into memory into two different
> arrays, each with two subscripts.
>
> According to my interpretation of the debug stream, when the program
> gets into the second line of variables, it hangs up on about the third
> variable. I am trying the following commands to read the file:
>
> #fopen MyFile2 "c:\pov31\include\traillist.txt" read
> #declare tt=0    ;
> #while (tt<350*clock+1)
> #declare n=0    ;
> #while (n<num)
> #debug "yeehah"
> #read (MyFile2,l,m,px,py,pz,vx,vy,vz)
>  #debug str(l,2,2)
>  #debug str(m,2,2)
>  #debug str(px,2,2)
>  #debug str(py,2,2)
>  #debug str(pz,2,2)
>  #debug str(vx,2,2)
>  #debug str(vy,2,2)
>  #debug str(vz,2,2)
> #declare actorp[tt][n]=<px,py,pz>;
> #declare actorv[tt][n]=<vx,vy,vz>;
> #declare n=n+1   ;
> #end
>
> #declare tt=tt+1;
> #end
>
> #fclose Myfile2
>
> Thanks for any possible help.   This "one hour" doofy project turned
> into a twelve hour battle with the software! I suspect the problem is
> in the use of two-dimensional arrays, as a much simpler,
> one-dimenstional array "reading" project works great.   If I may
> politely state so,  the 3.1a documentation preaches to the choir too
> often on syntax and rarely gives enough examples of how to actually use
> the terms. In this case, I don't know how to read my file.


Post a reply to this message

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