IDL XDR Problem [message #9444] |
Mon, 07 July 1997 00:00  |
Justin Baker
Messages: 16 Registered: May 1995
|
Junior Member |
|
|
Hi there,
I've got a problem with IDL when reading XDR data generated by a C
program.
I can happily read in longs or floats, but IDL gives a strange error
when I try and read in strings.
i.e % READU: Error encountered reading from file. Unit: 1
My program is very simple, for example
...
max_recs = 1000
rec = {i:0, l:0L, f:0.0, s:''}
data = replicate(rec,max_recs)
openr, /XDR, 1, bin_file,ERROR=err
rec_count = 0
while ((rec_count lt max_recs) and (NOT EOF(1))) do begin
readu, 1, rec
data(rec_count) = rec
rec_count = rec_count + 1
endwhile
One clue (that hasn't really helped !) is the IDL v4 user's guide (p
17-33). It demonstrates all that is needed to read XDR data into an IDL
program, but the C code it provides shows strings being written out
using a routine called xdr_counted_string().
Our machine (running AIX) only has xdr_string() and I can't find a
reference to this other routine on any other platforms (such as Sun)
either.
Has anyone else had a similar problem to mine ?
Thanks in advance,
Justin.
|
|
|