| Re: Problems to use variables in a keyword-expression [message #14320 is a reply to message #14314] |
Tue, 09 February 1999 00:00  |
J.D. Smith
Messages: 214 Registered: August 1996
|
Senior Member |
|
|
Ospite1 wrote:
>
> Hello,
>
> at the moment I have problems to find the right syntax for using
> variables in a
> keyword expression.
>
> My problem looks like this:
>
> the user should give an identifation number (num) for example
> 141098222.2 . With
> the FINDFILE command, which has integrated the count-keyword, I want to
> find the amount of all files in my directory ' paz' which begin with
> this number , they are named 141098222.21 , 141098222.22 etc.
>
> The expression has to be something like this :
>
> anzfile = FINDFILE [ string(num*),format='(i12)' , count=anz ]
>
> Unfortunalely this is command doesn't work.
>
> Please help me !
>
> Ruth
Try
anzfile=findfile(string(format='(I0,"*")',num),count=anz)
but only if num is an integer. If you really want num to be decimal,
your user must pass it in as a string, unless you just happen to know
you *always* want only one digit past the decimal, in which case you can
use a floating format. This is more error prone and dangerous, however.
Good Luck,
JD
--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
|
|
|
|