POV-Ray : Newsgroups : povray.general : #ifdef fails? : Re: #ifdef fails? Server Time
29 Jul 2024 06:17:50 EDT (-0400)
  Re: #ifdef fails?  
From: clipka
Date: 19 Nov 2012 02:34:46
Message: <50a9e116@news.povray.org>
Am 17.11.2012 20:22, schrieb Ger:
> Consider then following code;
>
>      #fopen FN FileName read
>      #ifdef (FN)
>        #while (defined(FN))
>          #read ( FN , Vector)
>          action( Vector )
>        #end
>      #end
>
> After processing Filename001 - FileName100, the next file doesn't exist
> (FileName101). Afaik #ifdef (FN) should catch that and not allow the #while
> loop to continue.

Well, if FN is undefined, the #while loop itself should refuse to run 
even a single time, so the #ifdef is redundant.

But if the file doesn't exist, #fopen doesn't fail with an undefined FN, 
but rather with an error message.

You might want to use the following code:

#if (file_exists(FileName))
   #fopen ...
   #while ...
     ...
   #end
#end


Post a reply to this message

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