comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Corruption of string variable in IDL V5.3

Corruption of string variable in IDL V5.3
type: item
description: 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.
creator: landsman
date: 2000-03-11T08:00:00-00:00