POV-Ray : Newsgroups : povray.advanced-users : File I/O question : Re: File I/O question Server Time
30 Jul 2024 04:20:25 EDT (-0400)
  Re: File I/O question  
From: David Vincent-Jones
Date: 10 Mar 2000 21:46:01
Message: <38c9b369$1@news.povray.org>
Looks like this would be a useful extension area for the language

If the full file is placed into an array. What is the array item select
procedure. I don't see anything in the Help and not much in the written
Docs.

David

Margus Ramst <mar### [at] peakeduee> wrote in message
news:38C99491.45FB4438@peak.edu.ee...
> Random reading is not very easy with POV. You have to move through records
one
> by one, i.e. to get to record N you have go through 1,2,3,...,N #reads.
For
> example get 10th record do sth. like this (untested):
>
> #fopen F "file" read
> #local N=10; file://Needed record
> #local C=0;
> file://Jump through the first 9 records
> #while (C<N)
>   #read(F,X)
> #end
> #read(F,NeededValue)
>
> Of course if all jumps are are known to be forward (i.e. the next record
is
> always somewhere after the current one) you don't have to start from the
> beginning every time (to restart from the beginning you have to close the
file
> and reopen it)
> Not very elegant; if memory is not a critical issue, I suggest you read
all
> values into an array, and use this instead.
> Also note that values _have_ to be separated by commas.
>
> Margus
>
> David Vincent-Jones wrote:
> >
> > I would like to be able to selectively read from a text file with
records
> > terminated with a line feed.
> >
> > The #read - #write looks just fine for a single item file but how can I
> > select a specific record?


Post a reply to this message

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