POV-Ray : Newsgroups : povray.general : File I/O and access modes Server Time
6 Nov 2024 16:29:53 EST (-0500)
  File I/O and access modes (Message 1 to 2 of 2)  
From: Tom York
Subject: File I/O and access modes
Date: 14 May 2004 08:20:00
Message: <web.40a4b923cd8d0b0e2ff34a90@news.povray.org>
I want to change a single item in a large file. I know how many other items
I must read to get to this desired item. Is there a compact way to do this
with #fopen and friends, or is my only option to read the whole file into a
large array, chang the one array entry I'm after and save the whole lot out
again?

Also, there isn't a shorthand notation for things like:

#local I = I + 1;

is there?


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: File I/O and access modes
Date: 14 May 2004 08:45:32
Message: <40a4bf6c$1@news.povray.org>
> I want to change a single item in a large file. I know how many other
items
> I must read to get to this desired item. Is there a compact way to do this
> with #fopen and friends, or is my only option to read the whole file into
a
> large array, chang the one array entry I'm after and save the whole lot
out
> again?

If you could do with a new filename, you could read/write one by one and
then change only the desired entry. Otherwise, that is pretty much the only
method. I'd have to add though, if this file is part of a larger system, and
that single entry needs to be modified more often than the rest, then you
might be better off splitting the file into two files, so you have less
workload to change that entry. That's why some of my Systems keep track of
several files (especially my LSSM, having something around 7 files I
think...).

> Also, there isn't a shorthand notation for things like:
> #local I = I + 1;
> is there?

Nope, that's the shortest possible way to increment a variable, unless you
delete the spaces... ;-)

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

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