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

Home » Public Forums » archive » Re: Reading string data from binary f77 files?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Reading string data from binary f77 files? [message #1637 is a reply to message #1636] Thu, 06 January 1994 15:18 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
scott@abyss.ATMOS.ColoState.Edu (Scott Denning) writes:

> I have binary files of model output that are set up with a bunch of header
> info, including a list of the names of the fields contained in the file.
> The files are written in IEEE binary by fortran 77 programs. I can read
> everything just fine into IDL by opening the file code like

> ..
> ARRAY1 = FLTARR(im,jm,lm)
> OPENR, 1, 'model.output', /F77_UNFORMATTED
> READU, 1, ARRAY1
> ..

> etc.

> The only trouble seems to be in reading the strings which are supposed to
> be the names of the fields (titles for the plots I make with IDL). I have
> been trying variations on

> title = StrArr(100)
> readu, 1, title

> All I get is an array of 100 nulls.

> Even reading a single character string like this:

> name = '123'
> readu, 1, header

> doesn't work.

> Any ideas?

The way to do this is to create a byte array with the correct number of
characters, read this into IDL, and then convert it to string. Assuming that
you're trying to read a title string with 100 characters in your example above,
this should do the trick:

title = bytarr(100)
readu, 1, title
title = string(title)

Bill Thompson
[Message index]
 
Read Message
Read Message
Previous Topic: Re: How to use fewer colors for Widget-app-window?
Next Topic: IDL color palette and tvrd

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

Current Time: Fri Oct 10 12:48:58 PDT 2025

Total time taken to generate the page: 0.56157 seconds