|
Re: Reading and Writing Files [message #45309 is a reply to message #45304] |
Tue, 30 August 2005 20:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Wayne Landsman writes:
>> I am having trouble with openU command. I have some text present in a
>> file and if I update that file with this command, the existing text
>> gets overwritten!
>
> You might try adding the /append keyword to OpenU. --Wayne
Ooops! Yes, that might work, too. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Reading and Writing Files [message #45310 is a reply to message #45309] |
Tue, 30 August 2005 20:22  |
Wayne Landsman
Messages: 117 Registered: January 1997
|
Senior Member |
|
|
<pravesh.subramanian@gmail.com> wrote in message
news:1125431518.674667.200700@g49g2000cwa.googlegroups.com.. .
> Hello,
>
> I am having trouble with openU command. I have some text present in a
> file and if I update that file with this command, the existing text
> gets overwritten!
You might try adding the /append keyword to OpenU. --Wayne
|
|
|
Re: Reading and Writing Files [message #45311 is a reply to message #45310] |
Tue, 30 August 2005 13:22  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
pravesh.subramanian@gmail.com writes:
> I am having trouble with openU command. I have some text present in a
> file and if I update that file with this command, the existing text
> gets overwritten!
> Now, I guess the way out would be to get the point_lun command to push
> the pointer to the end of the file so that there is no overwriting.
> How do I set it to end of the file?
OPENU, lun, 'myfile.dat', /Get_Lun
info = FSTAT(lun)
Point_Lun, info.size
> Another question regarding files is: after I have updated a file by
> running the update program, I would still get a message saying file is
> being used by another user (read-only mode) though I am careful enough
> to do a free_lun after using the lun. What could be wrong?
Maybe you are choosing a LUN (e.g., some number between 1 and 99)
and not closing the file. You need to choose one or the other of
these two ways of opening and closing the file:
OPENW, 5, 'Myfile.dat'
CLOSE, 5
Or,
OPENW, lun, 'Myfile.dat', /GET_LUN
FREE_LUN, lun
What you *can't* do is this:
OPENW, 5, 'Myfile.dat'
FREE_LUN, 5
> What would be the worst thing to do to make image display using tvscl
> go wrong?? I keep getting images in these wrong colors. By default, it
> is supposed to be yellow but it sometimes shows red and sometimes No
> color. I have the color table at top = topclr - 1
I'd argue that if colors were important to you, the *worst*
thing you could do is use TVSCL! You don't have any idea
how colors are allocated with this command. Use TV and
BYTSCL. Then you have some idea what you are doing.
Of course, if you are using TV (or TVSCL) for that matter,
and you don't have DEVICE, DECOMPOSED=0 there is no hope.
I'd use a better TV command, if I were you. IMGDISP, TVIMAGE,
and PLOTIMAGE are all freely available. Then you don't have
to worry about your color decomposition state or even whether
you have a 24-bit or 8-bit image. All of these routines will
do the right thing for you. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|