POV-Ray : Newsgroups : povray.newusers : file i/o directives Server Time
4 Nov 2024 23:15:36 EST (-0500)
  file i/o directives (Message 1 to 3 of 3)  
From: aitzolmuelas
Subject: file i/o directives
Date: 18 Aug 2004 12:50:00
Message: <web.412388722ebe0504b394c41d0@news.povray.org>
Hi there,

I am using some file io support to store data to be read later on, but I am
having some troubles. The file the data is read from a file in this format:

<a, b>, <c, d>
<e, f>, <g, h>
<i, j>, <k, l>
....

meaning two uv vectors separated by comma for eac line. The code that has to
be parsed is this:

#fopen a_file "grid.txt" read
//#declare vector1 = <0, 0>;
//#declare vector2 = <0, 0>;
#while(defined(a_file))
   #read(a_file, vector1, vector2)
   box{
      <vector1.x, vector1.y, -.001>, <vector2.x, vector2.y, .001>
      }
   #undef vector1
   #undef vector2
#end
#fclose a_file

the problem arises when parsing the statement in the box clause (the
vectors) The error message is "bad operands for period operator". If the
first two declarative lines are uncommented (as well as the undefs), the
error message reads: "expected 'undeclared identifier', uv vector
identifier found instead."
I thought that "read" worked fine with undeclared identifiers? Someone help
please, this is driving me mad!


Post a reply to this message

From: Daniel Hulme
Subject: Re: file i/o directives
Date: 18 Aug 2004 12:59:18
Message: <20040818175918.246ba5eb@dh286.pem.cam.ac.uk>
> //#declare vector1 = <0, 0>;
> //#declare vector2 = <0, 0>;
> #while(defined(a_file))
>    #read(a_file, vector1, vector2)
> #end

> the problem arises when parsing the statement in the box clause (the
> vectors) The error message is "bad operands for period operator". If
> the first two declarative lines are uncommented (as well as the
> undefs), the error message reads: "expected 'undeclared identifier',
> uv vector identifier found instead."
> I thought that "read" worked fine with undeclared identifiers? Someone
> help please, this is driving me mad!

"read" expects undeclared identifiers, so when you uncomment the first
two lines it gets confused because you haven't given it undeclared
identifiers, you've given it the names of UV vectors.
As for the original problem, I'm not really sure what's wrong. Perhaps
you might try writing ".u" and ".v" instead of ".x" and ".y"? Maybe
writing "(vector1.x)" instead of "vector1.x" and so on would work?

HTH,
Daniel

-- 
A most peculiar man    With the windows closed      And Mrs Reardon says
He died last Saturday  So he'd never wake up  He has a brother somewhere
He turned on the gas   To his silent world   Who should be notified soon
And he went to sleep   And his tiny room    .oO( http://sad.istic.org/ )


Post a reply to this message

From: ingo
Subject: Re: file i/o directives
Date: 18 Aug 2004 15:30:38
Message: <Xns9549DAD01A75Fseed7@news.povray.org>
in news:web.412388722ebe0504b394c41d0@news.povray.org aitzolmuelas wrote:

><a, b>, <c, d>
><e, f>, <g, h>
><i, j>, <k, l>
> 

You probably need to add some extra commas:

<a, b>, <c, d>,
<e, f>, <g, h>,
<i, j>, <k, l>,

Ingo


Post a reply to this message

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