comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: [question] on adding strings when reading file names
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: [question] on adding strings when reading file names [message #36973 is a reply to message #36961] Tue, 11 November 2003 10:31 Go to previous message
Pepijn Kenter is currently offline  Pepijn Kenter
Messages: 31
Registered: April 2002
Member
cmin wrote:
> Hi,
>
> I am new to this IDL group.
> I am trying to read multiple tiff images into my program.
>
> It was quite easy using C. But, since I am new to IDL, I am suffering.
>
> In C, it was something like the following:
> If I was reading frame0.tif, frame1.tif, frame2 ... frame9.tif
> I could run something like "read_frame frame%d.tif " and
> was able to read multiple frames.
>
> /********************
> read_frame.c
> ********************/
> int l, frames;
> char *ifile,ifile1[80];
> FILE *fpr;
>
> for(l=1;l<=9;l++){
> sprintf(ifile1,ifile,l);
> }
> if(!(fpr=fopen(ifile1,"r"))){
> printf("cannot open file: %s\n",ifile1);
> exit(1);
> }
> .....
>
>
> I would like to do a similar stuff using IDL, but not quite sure
> how to catenate the strings.
>
> I hope some one can give me some help.
>
> Thanx.

You can use c-style formats in IDL, the syntax is a bit awkward. Try
something like this:

for i = 1, 10 do begin
filename=string(format='(%"frame%d.tif")', i)
print, filename

openr, lun, filename, /get_lun
; read stuff
free_lun, lun ; close the file
endfor

Pepijn Kenter.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Goldstein Phase Unwrapper
Next Topic: Differences between IDL's floats and Java's floats - a problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Nov 30 23:47:28 PST 2025

Total time taken to generate the page: 0.80478 seconds