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

Home » Public Forums » archive » Re: Writing to ASCII 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: Writing to ASCII files [message #21329] Tue, 22 August 2000 00:00 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Jasmeet Judge <jjudge@indiana.edu> writes:

> 1. When I use printf (and even writeu), it gives me
> non-sensible results. Here is what I am doing
>
> openw,unitno,filename
> some loop with i
> printf,unitno,item1(i),item2(i)
> end loop
> close,unitno
>
> What I would like is:
> item1(0) item2(0)
> item1(1) item2(1)
> item1(2) item2(2)
> item1(3) item2(3)

Hi Jasmeet, what you have here looks like the right invocations, so I
am a little confused why you get garbage out. You can use a FORMAT
keyword as the other poster suggested, but by default you should get
something reasonable. Can you post the actual code (+ snippet of
data)? The only way I know to get unformatted/binary data out is to
use the WRITEU procedure.

> 2. Is there a way to open a file to write (with openw) but have
> it keep appending data at the end of file with every call to printf?
>
> It would simplify my life considerably, if I can figure this
> out! I have avoided dealing with this for too long....

The documentation is your friend. How about,

openu, unit, filename, /append
printf, unit, snorgle
close, unit

OPENU is for "update", and APPEND ensures that the file pointer is at
the end of the file.

Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Previous Topic: Re: "Ghostfont" - reproduced
Next Topic: CW_FORM woes

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

Current Time: Thu Oct 09 15:19:55 PDT 2025

Total time taken to generate the page: 1.35963 seconds