POV-Ray : Newsgroups : povray.general : #read problems : #read problems Server Time
26 Apr 2024 14:54:16 EDT (-0400)
  #read problems  
From: Kenneth
Date: 1 Oct 2018 05:10:00
Message: <web.5bb1e30d2a04246ea47873e10@news.povray.org>
I haven't used the #write/#read directives in quite a while, and I'm now having
a *basic* problem with the #read directive that's driving me crazy. (I'm running
3.7.1 beta 9 in Windows, BTW)

#declare AAA = <1,2,3>;

To write this to a new file:
#fopen FOOBAR "my file.txt" write
#write(FOOBAR, AAA)
#fclose FOOBAR

This successfully writes
<1,2,3>
to the file, on the first line. So far, so good.

During a later POV-Ray session, I want to read the file back into the same
scene, so I do this:

object{MY_OBJ
rotate
#fopen FOOBAR "my_file.txt" read
#read(FOOBAR,AAA)
#fclose // or this line can be commented-out
}

......but "my_file.txt" is *completely* ignored, as is the entire #fopen
construct. The fatal error message says, "Expected numeric expression, } found
instead", due to the rotate keyword apparently having nothing following it.

REMOVING the   rotate   keyword, but leaving the #fopen block intact, the scene
renders OK(!)-- but that seems quite strange: it's again as if the code block is
non-existent or invisible, when it should be throwing a fatal error.

I also tried this as a preliminary step:
#declare XYZ =
#fopen FOOBAR "my_file.txt" read
#read(FOOBAR,AAA)
; // semi-colon here...
#fclose // or this line can be commented-out
; // ... OR here; no change

...... but this produces its own (similar) fatal error, again as if the code
doesn't exist: "Expected Rvalue to declare, ; found instead"

So, what *basic thing* am I doing wrong?? I'm quite frustrated at this point.


Post a reply to this message

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