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

Home » Public Forums » archive » Corruption of string variable in IDL V5.3
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Corruption of string variable in IDL V5.3 [message #19291] Sat, 11 March 2000 00:00
landsman is currently offline  landsman
Messages: 93
Registered: August 1991
Member
I like the upgrade of the STRMID function in IDL V5.3 so that it can now
handle vector arguments. But the following code shows how in certain
cases, STRMID can also now corrupt a string variable:

IDL >print,!version
{ sparc sunos unix 5.3 Nov 11 1999}

st = 'idl40\avg.pro'
g = intarr(1)
st[0] = strmid(st[g], 6, 7)

; print,'st = ',st,byte(st)

name = st
name[0] = strmid(st[g],0,3 )

print,'st = ',st,byte(st)

If the first print statement is uncommented, then the output is as
expected:

st = avg.pro 97 118 103 46 112 114 111
st = avg.pro 97 118 103 46 112 114 111

But if the first print statement is left as a comment, then a byte(0)
gets inserted into the string, st

st = avgt,' 97 118 103 0 112 114 111

(You can imagine my frustration during debugging, not realizing that a
diagnostic print statement was changing the results.)

--Wayne Landsman landsman@mpb.gsfc.nasa.gov

P.S. A related wish for IDL V5.4 is that the STR_SEP function allow
vector arguments -- or at the very least, that it be rewritten
internally to use the vector features of STRMID.


Sent via Deja.com http://www.deja.com/
Before you buy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Converting 8-bit image + pallete to 24 bit image with alpha channel
Next Topic: Using Hardware rendering (Open GL) on a Mac

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

Current Time: Wed Oct 08 20:04:49 PDT 2025

Total time taken to generate the page: 0.00577 seconds