POV-Ray : Newsgroups : povray.general : #read-question : Re: #read-question Server Time
3 Aug 2024 20:17:51 EDT (-0400)
  Re: #read-question  
From: Barron Gillon
Date: 2 Nov 2003 16:49:02
Message: <3fa57bce@news.povray.org>
My guess would be:
Compilers (and interpreters, like povray) are told to ignore whitespace
charachters, ' ', '\n' and the like.  However, when you read from a file,
you are simply reading a stream of data.  The computer doesn't care, or
know, what the data is, it just assumes that it is what the reading program
thinks it is.  So, when you read your multilined file, you read a vector
<0,0,0>, then you try to read another vector, so pov eats the ',' and
notices that the next charachter, which should be '<' is actually a newline
charachter, '\n'.  As I see it, you have three options.  Either deal with
reading a one line file, read a newline charachter after each line (I'm just
guessing that will work), or you could do what I do and output your data in
a form that pov can parse, and then simply #include it.  Yes, it makes
writing considerably more complicated, but it pretty much eliminates
reading, which means you have less code to write, giving you fewer
opportunities to write bugs into your code.  And probably best of all, when
you want to change the data being written in the file, you only have to
change your code in one place, and you know it will work.

Barron Gillon


Post a reply to this message

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