POV-Ray : Newsgroups : povray.general : dynamic memory possible? : Re: dynamic memory possible? Server Time
31 Jul 2024 10:20:22 EDT (-0400)
  Re: dynamic memory possible?  
From: Penelope20k
Date: 4 Jun 2007 07:32:22
Message: <4663f846@news.povray.org>
you should simply answer this question.


Why did you open the same file under 2 differents name ?





news:web.4663e8a8e799405a678ea4f80@news.povray.org...
> Hello there,
> I hope you understand my question, it's directly translated from German...
> ;)
>
> I have a file with some coordinates I want to store in an array. Since I
> don't know how to store in an array that was not defined before I do this:
> --------------------------------------
> #fopen fsbsp "124440_ACR.txt" read
> #declare fs_count = 0;
> #while(defined(fsbsp))
>   #read (fsbsp,utm_x,utm_y,utm_z)
>   #declare fs_count = fs_count+1;
> #end
> #debug concat("fs_count     ", str(fs_count, 0,0),"n")
>
> #declare a_pos = array[fs_count];
>
> #fopen a_pos_f "124440_ACR.txt" read
> #declare fs_count2 = 0;
> #while(defined(a_pos_f))
>   #read (a_pos_f,utm_x,utm_y,utm_z)
>   #declare a_pos[fs_count2] = <utm_x,utm_y,utm_z>;
>   #declare fs_count2 = fs_count2 + 1;
> #end
> --------------------------------------
> Here's what this does:
> - opens the file and "counts" the rows
> - closes the file (#while(defined(...)))
> - defines the array
> - opens the file again
> - reads and stores values
> - closes the file again
>
> Is there any possibility to do this without opening and reading the file
> twice? I know Java can do dynamic memory (if that's what it is called),
but
> POV?
>
> Thanks in advance
> Gunnar
>
>
>


Post a reply to this message

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