POV-Ray : Newsgroups : povray.general : #read problems : Re: #read problems Server Time
17 Jun 2024 04:43:59 EDT (-0400)
  Re: #read problems  
From: Kenneth
Date: 1 Oct 2018 14:55:01
Message: <web.5bb26c4777bafcca47873e10@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

>
> doing:
>
> #read (FP, AAA)
> rotate AAA
>
> should work.  (tried with debug concat, on v.3.8.0 alpha)
>

Thanks! It does indeed.

My own proper syntax is now:
object{MY_OBJ
#fopen FOOBAR "my_file.txt" read
#read(FOOBAR,AAA)
#fclose FOOBAR
rotate AAA
}

(Actually, the #fopen block could go *anywhere* in the scene code prior to AAA
being used.)

But this *proper* syntax didn't occur to me, for a reason (even though the
documentation at #read DOES include a #while-loop version of it): With the
#fclose FOOBAR command present, it *appears* that the AAA vector is only "here
and gone in a flash",  before the rotate command even has a chance to use it!
Not true, of course, but that's how the 'linear' nature of the code looks to me,
during the parsing stage. It's not obvious that AAA 'hangs around' or remains in
memory(?) after the txt file is closed. (There's no actual #declare or #local
anywhere.)

BTW, this also works OK:
#fopen FOOBAR "my_file.txt" read
#read(FOOBAR,AAA)
rotate AAA
#fclose FOOBAR


Post a reply to this message

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