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

Home » Public Forums » archive » Re: Removing CRLF from a String
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: Removing CRLF from a String [message #11344] Mon, 23 March 1998 00:00
wmc is currently offline  wmc
Messages: 117
Registered: February 1995
Senior Member
In article A6AD4CD5@fl.ensco.com, Jeff <jeffe@fl.ensco.com> writes:
> IDL was outputting the following message to me:
>
> % XMANAGER: Caught unexpected error from client application. Message
> follows...
> % MESSAGE: Expression must be a scalar in this context: <STRING
> Array[1]>.
>
> After tracking down what it really meant, I found that the fileName
> I was passing to the READ_ASCII routine had a CR at the end of it.

Hmmm... this might be your problem, but I humbly suggest that the actual problem
is that you are passing a string array (of length 1, true, but nonetheless an
array) to a routine that expects a scalar. Try read_ascii(your_string(0)).

> Content-Type: application/x-unknown-content-type-IDLprogramFile; name="testIt.pro"
> Content-Transfer-Encoding: base64
> Content-Disposition: inline; filename="testIt.pro"
>
> UHJvIHRlc3RJdF9FdmVudHMsIGV2ZW50DQoNCg0KZXZlbnROYW1lID0gVGFn X05hbWVzKGV2
An interesting program, no doubt, but incomprehensible to my poor eyes. Perhaps
next time you might send it as simple text rather than encoded?

- William

---
William M Connolley | wmc@bas.ac.uk | http://www.nbs.ac.uk/public/icd/wmc/
Climate Modeller, British Antarctic Survey | Disclaimer: I speak for myself
Re: Removing CRLF from a String [message #11363 is a reply to message #11344] Fri, 20 March 1998 00:00 Go to previous message
David Burridge is currently offline  David Burridge
Messages: 33
Registered: January 1998
Member
Jeff,

Are you sure that it's the CR that is the problem? From your example I
don't.

I see this message a lot when I'm testing a variable that has been
extracted from an array or that comes from a routine that can return
arrays. It normally means that you've got an 1 element array of strings, as
opposed to just a string (doing a help on "filename" and "directoryname"
confirms this).

To cure the problem, use REFORM to remove dimensions of 1 from the array:
filename = REFORM (filename)

BTW: To get IDL to crash (and help with your debugging), type XMANAGER,
CATCH=0 at the prompt. Don't forget to RETALL and XMANAGER after a crash,
though - just like you used to IDL 4!

Cheers,

Dave

Jeff <jeffe@fl.ensco.com> wrote in article
<351154EA.A6AD4CD5@fl.ensco.com>...
> IDL was outputting the following message to me:
>
> % XMANAGER: Caught unexpected error from client application. Message
> follows...
> % MESSAGE: Expression must be a scalar in this context: <STRING
> Array[1]>.
>
> After tracking down what it really meant, I found that the fileName
> I was passing to the READ_ASCII routine had a CR at the end of it.
> (Boy I wish it returned a line number or Procedure where it bombed)
>
> I am using the CW_FIELD to get the string, so I do I avoid getting
> the CR, or how do I remove it.
>
> I've tried STRTRIM but it leaves CR's.
> I've tried using a WIDGET_TEXT rather than a CW_FIELD but get the
> same results.
>
> My simple example program is attached.
>
> Thanks,
>
> Jeff
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: bug in program going from pc to sun
Next Topic: Re: another call_external newbie

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

Current Time: Fri Oct 10 06:28:23 PDT 2025

Total time taken to generate the page: 0.40313 seconds