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

Home » Public Forums » archive » unformatted strings (reading)
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
unformatted strings (reading) [message #5722] Sat, 03 February 1996 00:00 Go to next message
immel is currently offline  immel
Messages: 3
Registered: February 1996
Junior Member
Here's a question for anyone who reads unformatted strings.
Is there a way to read a whole ,say 10 character, string at once
in IDL? Here's what is happening to me.

1)Open an unformatted idl file and write a silly string like 'stumblefloppy'

get_lun,unit
openw, unit, 'silly.dat'
writeu,unit,'stumblefloppy'
free_lun, unit

2) Try to read the string

bonk=' ' ; this is the string variable that I read into
get_lun,unit
openr, unit, 'silly.dat'
readu, unit, bonk

3) OK, I'm ready to print 'stumblefloppy'!

print,bonk
s

's' !?!? Just the first character. If I define bonk to be two spaces or three
spaces then i get 'st' or 'stu' back. I know it's cause each character is 2
bytes or something like that. Is there any way, other than defining bonk as 13
blank spaces before reading,
that I can read this string? Any bright ideas would be appreciated!

Thomas Immel
Immel@geewiz.gi.alaska.edu



P.S. Ken Knighton, whoever he is, is RIGHT ON!
Re: unformatted strings (reading) [message #5778 is a reply to message #5722] Fri, 09 February 1996 00:00 Go to previous message
immel is currently offline  immel
Messages: 3
Registered: February 1996
Junior Member
immel@gi.alaska.edu (Thomas Immel) wrote:

Thanks for the informative posts and E-mail.
The external data representation is just the thing
I needed to hear about. Thanks again

Thomas Immel
> Here's a question for anyone who reads unformatted strings.
> Is there a way to read a whole ,say 10 character, string at once
> in IDL? Here's what is happening to me.

> 1)Open an unformatted idl file and write a silly string like 'stumblefloppy'

> get_lun,unit
> openw, unit, 'silly.dat'
> writeu,unit,'stumblefloppy'
> free_lun, unit

> 2) Try to read the string

> bonk=' ' ; this is the string variable that I read into
> get_lun,unit
> openr, unit, 'silly.dat'
> readu, unit, bonk

> 3) OK, I'm ready to print 'stumblefloppy'!

> print,bonk
> s

> 's' !?!? Just the first character. If I define bonk to be two spaces or three
> spaces then i get 'st' or 'stu' back. I know it's cause each character is 2
> bytes or something like that. Is there any way, other than defining bonk as 13
> blank spaces before reading,
> that I can read this string? Any bright ideas would be appreciated!

> Thomas Immel
> Immel@geewiz.gi.alaska.edu



> P.S. Ken Knighton, whoever he is, is RIGHT ON!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: [Q] IDL compiling error ?
Next Topic: Bug in PV-Wave 6.0

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

Current Time: Wed Oct 08 19:42:37 PDT 2025

Total time taken to generate the page: 0.00470 seconds