POV-Ray : Newsgroups : povray.newusers : Using a word as a string and as a variable Server Time
27 Nov 2024 02:41:38 EST (-0500)
  Using a word as a string and as a variable (Message 1 to 4 of 4)  
From: Kaveh
Subject: Using a word as a string and as a variable
Date: 8 Aug 2003 13:35:07
Message: <1fzdy3a.1uqiza819cf4ckN%kaveh@delete_this.focalimage.com>
I want to make it easy to write out my data to a file, using a macro
like:

 write_it(my_var)

which would envoke:

  #fopen myfile "abn.data" append
    #write(myfile,"my_var = ",my_var,"\n")
  #fclose myfile   

So my_var is output verbatim, then with its current value. How can I do
this?

-- 
Kaveh


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Using a word as a string and as a variable
Date: 8 Aug 2003 15:57:58
Message: <3f3400c6$1@news.povray.org>
In article <1fzdy3a.1uqiza819cf4ckN%kaveh@delete_this.focalimage.com> , 
kav### [at] delete_thisfocalimagecom (Kaveh) wrote:

> So my_var is output verbatim, then with its current value. How can I do
> this?

The short answer ould be you can't.  The long answer would be to generate an
include file which does it for you.  That is, pass the variable name as
string.  Open an include file and write to it the three lines you quoted.
Then include that include file and it will output the variable for you.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Kaveh
Subject: Re: Using a word as a string and as a variable
Date: 8 Aug 2003 18:52:11
Message: <1fzecw4.7o68oe1yxgwrcN%kaveh@delete_this.focalimage.com>
Thorsten Froehlich <tho### [at] trfde> wrote:

[...]

> The short answer ould be you can't.  The long answer would be to generate an
> include file which does it for you.  That is, pass the variable name as
> string.  Open an include file and write to it the three lines you quoted.
> Then include that include file and it will output the variable for you.

Wonderful. Thank you.
-- 
Kaveh


Post a reply to this message

From: ABX
Subject: Re: Using a word as a string and as a variable
Date: 11 Aug 2003 05:22:27
Message: <nunejvkg6b1n445p8ilipn1np12s6iaqgh@4ax.com>
On Fri, 8 Aug 2003 18:35:07 +0100, kav### [at] delete_thisfocalimagecom (Kaveh)
wrote:
> I want to make it easy to write out my data to a file, using a macro
> like:
>
> write_it(my_var)
>
> which would envoke:
>
>  #fopen myfile "abn.data" append
>    #write(myfile,"my_var = ",my_var,"\n")
>  #fclose myfile   
>
> So my_var is output verbatim, then with its current value. How can I do
> this?

There is Parse_String macro available in include files of official 3.5
distribution.

ABX


Post a reply to this message

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