POV-Ray : Newsgroups : povray.general : File handles for output streams : Re: File handles for output streams Server Time
29 Jun 2025 12:58:08 EDT (-0400)
  Re: File handles for output streams  
From: Cousin Ricky
Date: 19 Jun 2025 12:24:06
Message: <685439a6$1@news.povray.org>
On 2025-06-19 09:39 (-4), Chris R wrote:
> 
> Follow-up question: it appears you can't pass file handles as parameters to
> macros.  No tricks for that either?

Here's my workaround:

---%<-----%<-----%<---[BEGIN CODE]---%<-----%<-----%<---
#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")
--->%----->%----->%----[END CODE]---->%----->%----->%---


Post a reply to this message

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