using variables in file names

andu undo at cloud9.net
Mon Jul 1 15:50:00 EDT 2002


--On Monday, July 1, 2002 3:31 PM -0400 "Lurie, Nicholas" 
<lurien at bschool.unc.edu> wrote:

>
> Is there anyway to create a file using a variable?
>
> Suppose I have a variable called sub and I want to save text to a file
> named sub.txt where sub is a number from 1 to 100.
>
> Normally, I would write
>
> open file "sub.txt"
> put results & cr into file "sub.txt" at eof
> close file "sub.txt"
>
> How can I change the filename based on the current value of sub?

put 5 into sub
open file (sub & ".txt") # or without ()
put the result into file (sub & ".txt") at eof
close file (sub & ".txt")

Alternatively you can do:
put 5 & ".txt" into sub
open file sub

>
> Thanks!



Regards, Andu Novac



More information about the metacard mailing list