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

Home » Public Forums » archive » Text output line too short, width = val not working
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: Text output line too short, width = val not working [message #91113 is a reply to message #91110] Thu, 04 June 2015 13:18 Go to previous message
laura.hike is currently offline  laura.hike
Messages: 87
Registered: September 2013
Member
The header line, printed as a single string, is 163 characters long. It prints out fine, with or without using a WIDTH specifier, thus defying the 80 character limit.

There is actually a line before this header, printed using the statement

printf, lun, site, sitelat, sitelon, ' ' + systime()

It turns out that this IS split between two lines, where site, sitelat, and sitelon take up 32 spaces on one line and ' ' + systime() takes up 54 spaces on the next line. That's more than 80 characters, but the position of the split makes no sense. If I eliminate some of the spaces so that the total line length is 80 spaces, it does print out to one line. If I make it longer again, but include WIDTH = 120, it prints to a single line. Thus this statement conforms to the 80 character limit and WIDTH adjustment conventions.

In order to try formatting, I replaced systime() with another string of the same length (24 characters) because I don't see a way to use a format statement to get the standard systime output. Keeping the automatic formatting, the behavior is exactly the same. If I add formatting to copy this line, e.g.,

printf, lun, format = '(A6, F13.4, F13.3, A24, A24)', site, sitelat, sitelon, ' ', dummy

I can go beyond an 80 space line. In fact, I tried changing the blanks to numbers, and was able to print out as many as 208 characters on the same line without using a WIDTH parameter before I got tired of adding more characters and trying again.

So now we have two cases that defy the 80 character limit and one that doesn't. It would seem that formatting has precedence over the limit and automatic formatting doesn't -- but printing out a single long string is also fine. Exelis people, can you explain this? I'm running IDL 8.4.1 under Debian linux.


>
> On Thursday, June 4, 2015 at 7:11:42 AM UTC-7, David Fanning wrote:
>> Laura H. writes:
>>
>>> I'm writing an ascii file of data and some of the numbers are wrapping to a second line. On a couple of web pages, I find a suggested solution of adding width = somevalue to the end of my openw statement. I tried several different values, all the way up to 400, and found no change in my output. Any idea why this is? The relevant code and output lines are below. Interestingly, the header line (just text) prints out fine regardless of whether I use a width parameter.
>>
>> Well, you are using a FORMAT statement. So, I wouldn't expect a change
>> when the WIDTH of the line is changed. If the FORMAT statement doesn't
>> allow a single line of output, EVEN when the WIDTH of the line is
>> changed, I would immediately suspect something is up with the FORMAT
>> statement.
>>
>> Yours is so complicated, however, that I can't tell what the problem
>> might be. Try a very simple FORMAT and see if that doesn't shed some
>> light on this problem, before you retreat to your more complicated
>> design.
>>
>> Cheers,
>>
>> David
>>
>> P.S. You ARE sure that the wrapping you are seeing is not related to the
>> configuration of the software you are using to view the output file,
>> right? For example, I have to turn Word Wrap off in my Notepad
>> application to view these kinds of text files properly.
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL v8 not recognizing bash environment variable
Next Topic: How to supress output from going to new line

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

Current Time: Wed Oct 08 20:08:32 PDT 2025

Total time taken to generate the page: 0.81936 seconds