POV-Ray : Newsgroups : povray.newusers : File handle and macros : File handle and macros Server Time
18 May 2025 04:32:19 EDT (-0400)
  File handle and macros  
From: kurtz le pirate
Date: 30 Apr 2025 05:28:18
Message: <6811ed32$1@news.povray.org>
Hello,


I have a problem with the file handle parameters in macros.

The following SDL shows the problem :
--------------------------------------------------------------------------
  1 : #macro fwrite (FILE, texte)
  2 : 	#write (FILE, concat(texte,"\n") )
  3 : #end
  4 :
  5 :
  6 : #macro OpenFile (FileName)
  7 : 	#fopen FILE_HANDLE_IDENTIFIER FileName write
  8 : 	fwrite (FILE_HANDLE_IDENTIFIER, "bla bla bla")
  9 : 	FILE_HANDLE_IDENTIFIER
10 : #end
11 :
12 :
13 : #declare MyFile1 = OpenFile ("testfile.txt");
14 :
--------------------------------------------------------------------------


Runnins this simple test raise this error :

line 8
Parse Error: Expected 'macro parameter', file identifier found instead


"fwrite" macro take two parameters : the file handle and a string.
On line 8, I call this macro with the two "correct" parameters.

I thought it was "correct" but POV no!

My idea for the fwrite() macro (simplified here) is that it allows you 
to write to different files open at the same time in the same way.


So we can't pass a file handle as a parameter ?
Thank you for your feedback.





-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message

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