Am 01.10.2018 um 21:16 schrieb Kenneth:
> I'm curious about something: What is the actual problem when trying to do...
> #fopen FOOBAR "my_file.txt" read
> #fclose FOOBAR // or this line can be commented-out, with no change
> At first glance, this *looks* like it should be simple substitution of the
> #written AAA vector into 'rotate' (kind of like the behavior of a macro.) But
> this is the situation where the #fopen block appears to be 'invisible' to the
> scene code, along with one of the fatal error messages. I'm not yet 'seeing' the
> reason for its failure.
It's pretty simple: `#read(FOOBAR,AAA)` is not a function that
/evaluates to/ the value read from the file; it is an instruction (or
directive) that /sets/ `AAA` to the value read. It's pretty much a
`#declare` on steroids.
So when all is said and done, the whole construct presents itself to the
final parser stage as:
The solution is to change the construct to:
#fopen FOOBAR "my_file.txt" read
#fclose FOOBAR // or this line can be commented-out, with no change
AAA // <-- !!!!
With that change, it eventually presents itself as:
> IMO, the original author assumed a level of C or C++ knowledge (or some other
> language) on the part of the user, as to the rules and usage of #write/#read.
> (Maybe that *was* the case way back when, when the 'typical' POV-user was
> probably a computer programmer.) But some useful, basic(?) info has been left
> out (yes, 'spoon-feeding', ha.) I remember being similarly stuck and frustrated
> years ago, when I first tried using these in POV-ray. That's unfortunate,
> because #write and #read are really powerful tools. It would SO nice not to have
> to initially run dead-end experiments, simply to arrive at some working code.
I think I'm getting a feel for where your misunderstanding is coming
from, and yes, I agree that the docs do nothing to get you off that
track and onto the right one.
Post a reply to this message