Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
rensheu@yahoo.com writes: > I have a question about type conversion in IDL. > > I get a float value return by IDLffDICOM object, but it is stored in > byta[4]. Is there any way like in C as follows, > > char byta[4]={103, 38, 18, 68}; > float tmpv; > > pf = (float *)(&bytarr); > tmpv = (float)(*pf); > > convert the varible from a 4 elements byte array to a float point > variable in IDL? Try this: byta = [103B, 38B, 18B, 68B] var = Float(byta, 0) You need the offset (the second positional parameter), as I just learned again this morning to my chagrin. :-( Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/
Hi David, Thank you so much!! R.D.