[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reading a Mac text file on Windows



Ronn Kling (ronn@rlkling.com) writes:

> I have an ascii text file that was created on a Mac that now resides on
> Windows. I need to be able to read this into IDL on Windows, but so far
> I have had no luck. (On a Mac the end of line is a linefeed, on Windows
> it is a carriage return/line feed. On Windows, IDL thinks this is a one
> line file).  I would like some IDL technique to read this, but if
> someone has some C code that can do it I would be interested.

I'm sure some Mac guy will have better advice than this,
but if you can't do the translation from Mac to PC format
when you transfer the file (e.g. your FTP application will
often do it automatically for you) then I don't think you
have a lot of options in IDL except to read one huge line
(usually as a byte array, since anything else is too small)
and parse it.

But I've had good luck opening files like this in some
kind of reasonably intelligent text editor. I like Notetab,
a wonderful freeware editor written my Eric Fookes
(http://www.unige.ch/sciences/terre/geologie/fookes/).
The "professional" version is all of $5, which I was only
too happy to fork over. :-)

Hitting a couple of option switches soon gets the file
in the format you hoped it would be in, you re-save it,
and you are good to go. Not elegant, perhaps, but it
sure beats scratching your head and and spending two
hours working something out in IDL. (Unless, of course,
the clock is running on a consulting project. :-)

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155