POV-Ray : Newsgroups : povray.general : #read file directive... problem? : #read file directive... problem? Server Time
5 Aug 2024 06:20:19 EDT (-0400)
  #read file directive... problem?  
From: Marc Champagne
Date: 17 Nov 2002 23:03:30
Message: <Xns92C9EA8D6BC1APOVMIKA@204.213.191.226>
Hi Folks,

I've been trying to read in a text file and can
make no sense of the end results


Create a file named text.txt and put the following into it

-------------BEGIN-----------
"line1"
"line2"
"line3"
"line4"
"line5"
"line6"
-------------END-----------

and then run this code within a scene file (.pov)

-------------BEGIN-----------
#debug "\n--------------------\n"
#declare Lines=0;
#fopen Io "text.txt" read
  #while ( defined(Io) )
    #read (Io,Pat)
    #if ( defined(Io) )
      #debug Pat
      #debug "\n"
      #declare Lines=Lines+1;
    #end
  #end
#fclose

#debug str(Lines,0,0)
#debug " Lines read"
#debug "\n--------------------\n"
-------------END-----------


My results of running above code gives

-------------BEGIN-----------
line1
line3
line5
3 Lines read
-------------END-----------

The results are the same for line termination being LF's or CR/LF's

Baffled

-- 
(MIKA) Marc Champagne
marcch.AT.videotron.DOT.ca
Montreal, CANADA


Post a reply to this message

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