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

Home » Public Forums » archive » Re: One for the experts...
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
Re: One for the experts... [message #13377] Fri, 06 November 1998 00:00
davidf7203 is currently offline  davidf7203
Messages: 12
Registered: August 1998
Junior Member
Peter Mason, always elegant, writes:

> One for the experts? This is entrapment! But it's interesting; I'll bite
> regardless...

[...excellent analysis snipped...]

I know other people have mentioned it lately, but I just want to
say that I *really* like this newsgroup. :-)

> I don't know IDL/Linux but with IDL/Windows there is another little nasty
> lurking about. If you want to be 100% sure of doing strict BINARY I/O on
> IDL/Windows, you have to open your files with /BINARY,/NOAUTOMODE, otherwise
> things can occasionally go bizarrely wrong.

Seriously!? In what way?

Cheers,

David
davidf@dfanning.com
[Please follow up with e-mail. My news feed is kaput!]

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Re: One for the experts... [message #13381 is a reply to message #13377] Thu, 05 November 1998 00:00 Go to previous message
menakkis is currently offline  menakkis
Messages: 37
Registered: June 1998
Member
One for the experts? This is entrapment! But it's interesting; I'll bite
regardless...

gadagkar@norland.com wrote:
> I have been using IDL (on a Linux OS) for R&D work but our normal application
> software is a DOS application written in C. The database and image header
> structures have been written such that there are no bytes appended to fields
> of structures that do not align themselves on 8 byte boundaries. The spaces
> (if any) between fields of a structure are removed by using the "packed"
> attribute (GNU CC). So what I have to do is read binary files that have
> headers that are "packed" from an IDL application running on a Linux box.

I haven't looked into this thoroughly, just a bit, but as far as I can tell,
IDL's READU and WRITEU (with structures) keep files lean. READU expects to
find no padding bytes in the file (it pads up after reading), and WRITEU
writes no padding bytes (it strips them off before writing). By padding
bytes I mean both alignment bytes before multibyte structure members and
alignment bytes between structure array elements (if you have an array of
structures).

So if you define an IDL structure that exactly matches your C structure, READU
and WRITEU *will* work.

Well, I guess I forgot about strings for the moment. If your C structure
includes string members, they will be defined as fixed-length char arrays, of
course. You should do the "same" in your IDL structure - use BYTARRs of the
same size as in the C structure for these members.

IDL's other method for accessing binary files - ASSOC - is a bit different.
The past and current-default behaviour for ASSOC is that it DOES read and
write padding bytes. In IDL 5.2, though, there's a new keyword PACKED that
will make ASSOC work lean.

I don't know IDL/Linux but with IDL/Windows there is another little nasty
lurking about. If you want to be 100% sure of doing strict BINARY I/O on
IDL/Windows, you have to open your files with /BINARY,/NOAUTOMODE, otherwise
things can occasionally go bizarrely wrong.


Peter Mason

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Replacement for DISSPLA - IDL or PVwave?
Next Topic: Re: IDL colors on Linux XFree86

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

Current Time: Fri Oct 10 11:27:23 PDT 2025

Total time taken to generate the page: 0.55921 seconds