POV-Ray : Newsgroups : povray.general : Can I not pass a file to a macro? : Re: Can I not pass a file to a macro? Server Time
29 Jul 2024 12:22:24 EDT (-0400)
  Re: Can I not pass a file to a macro?  
From: Cousin Ricky
Date: 5 Aug 2011 20:55:00
Message: <web.4e3c909e3ab75a4285de7b680@news.povray.org>
"B. Gimeno" <nomail@nomail> wrote:
> By the way, is there a powerful and unavoidable reason to introduce as a
> parameter the id_file handler?

Yes.  If the macro is called more than once.

I found a workaround, though.

#macro Write_something (Filename, N)
   #fopen F Filename append
   #write (F, N)
   #fclose F
#end

#declare FILE1 = "test.txt"
#fopen F FILE1 write #fclose F //zero the output file
Write_something (FILE1, "Hello,\n")
Write_something (FILE1, "world.\n")


Post a reply to this message

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