using variables in file names
Klaus Major
k_major at osnabrueck.netsurf.de
Mon Jul 1 15:44:01 EDT 2002
Hi Nicholas,
> 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?
>
> Thanks!
this is an easy one.
You just have to build a string like:
open file (sub & ".txt")
put results & cr into file (sub & ".txt") at eof
close file (sub & ".txt")
You can have it even shorter:
...
put results & cr into url("file:" & sub & ".txt")
...
That's all, have fun :-)
Regards
Klaus Major
k_major at osnabrueck.netsurf.de
More information about the metacard
mailing list