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

Home » Public Forums » archive » Re: to R. Bauer
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: to R. Bauer [message #13978] Thu, 14 January 1999 00:00
menakkis is currently offline  menakkis
Messages: 37
Registered: June 1998
Member
TTs <TTs@newsguy.com> wrote:
> In article <369CED49.F40D6668@fz-juelich.de>, "R.Bauer" says...
>>
>>> Using IDL 5.1 in a PentiumII NT 4.0 box this line of code:
>>>
>>> for i=0L, 307199 do printf, wlun, image(i), format='(I1)'
>>>
>>> create files with RETURN (\r) and LINE FEED (\n) terminations...
>>>
>>> How could I modify this so just RETURNS (^M) is used to finish the lines?
>>
>> Use the binary key with openw
>
> Could you plase tell me more details about this? I am a kinda of newbie with
> IDL...

Since you posted this to the group, I'll take the liberty of joining in. I
believe that R. Bauer means the optional keyword /BINARY for the OPEN
command. Now this feature is a strong contender for the nastiest corner in
the IDL universe. It is truly hideous. Unspeakable. A shock to one's
sensibilities. Another monument to that billionare dude. OK, sorry. I'll
try to explain...

On Windows platforms (and not on ANY other platforms), IDL sports optional
keywords BINARY and NOAUTOMODE for the OPENU (open existing file for update)
command. (The docs only mention these keywords for OPENU, but they appear to
work for OPENW as well. Haven't bothered to verify OPENR.) The default when
you open a file for update is that it happens in "text mode" - and this means
that <CR><LF> pairs in the datastream are UNAFFECTED. (This will come as a
bit of a disappointment to anyone who might have used UNIX or even just FTP.)
If you OPENU/BINARY it's supposed to turn on filtering of <CR><LF>, maybe.
The thing is, if you then use PRINTF it'll (reportedly) flip the thing to
"text mode". So it looks like /BINARY on its own won't cut it. You have to
do OPENU,/BINARY,/NOAUTOMODE to get the filtering to happen.

There it is - that's essentially what's in the online manual, and that's what
appears to happen. I normally get it the wrong way round, but I do believe I
have the contortions right this time. Basically this whole arrangement is so
fishy and ill-explained that most of us just try to avoid it or pretend that
it isn't there.

BTW, this filtering will strip out the <CR>s (char(13)) in <CR><LF> pairs,
leaving just the <LF>s (char(10)). Unix style. I don't know about stripping
out <LF>s.


Peter Mason.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Re: to R. Bauer [message #13981 is a reply to message #13978] Thu, 14 January 1999 00:00 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
TTs wrote:

> In article <369CED49.F40D6668@fz-juelich.de>, "R.Bauer" says...
>>
>>> Using IDL 5.1 in a PentiumII NT 4.0 box this line of code:
>>>
>>> for i=0L, 307199 do printf, wlun, image(i), format='(I1)'
>>>
>>> create files with RETURN (\r) and LINE FEED (\n) terminations...
>>>
>>> How could I modify this so just RETURNS (^M) is used to finish the lines?
>>
>> Use the binary key with openw
>
> Could you plase tell me more details about this? I am a kinda of newbie with
> IDL...

file='test'
OPENW, lun, file,/GET_LUN ,/BINARY
for i=0L, 100 do printf, lun, byte(i)
FREE_LUN,lun

I don't know if image is a function or an array. If you mean an array you should
use [i].

R.Bauer
Re: to R. Bauer [message #13987 is a reply to message #13978] Wed, 13 January 1999 00:00 Go to previous message
TTS is currently offline  TTS
Messages: 4
Registered: November 1998
Junior Member
In article <369CED49.F40D6668@fz-juelich.de>, "R.Bauer" says...
>
>> Using IDL 5.1 in a PentiumII NT 4.0 box this line of code:
>>
>> for i=0L, 307199 do printf, wlun, image(i), format='(I1)'
>>
>> create files with RETURN (\r) and LINE FEED (\n) terminations...
>>
>> How could I modify this so just RETURNS (^M) is used to finish the lines?
>
> Use the binary key with openw

Could you plase tell me more details about this? I am a kinda of newbie with
IDL...
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL using MATLAB DLL's
Next Topic: Slicer3

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

Current Time: Fri Oct 10 12:02:27 PDT 2025

Total time taken to generate the page: 1.03864 seconds