POV-Ray : Newsgroups : povray.general : Reading from a text file : Re: Reading from a text file Server Time
29 Jul 2024 10:26:21 EDT (-0400)
  Re: Reading from a text file  
From: Bill Pragnell
Date: 5 Jan 2012 10:45:00
Message: <web.4f05c4c58e1c2e696dd25f0b0@news.povray.org>
The #read section in the docs says that a vector identifier used in this way
should be predeclared. You've declared the array, but not initialised the
element you're trying to read into. Try:

#fopen MyFile "myData.txt" read
#local i = 1;
#while (i<2)
  #local Vector[i] = <0,0,0>;
  #read (MyFile,Vector[i])
  #local i = i + 1;
#end

Also note that arrays are zero-based in index, and your code will only attempt
to read 1 vector from the file. You should set i = 0 instead, unless I have
misread your intentions!

Bill


Post a reply to this message

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