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

Home » Public Forums » archive » Re: Fast editing of text file?
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: Fast editing of text file? [message #44469 is a reply to message #44448] Thu, 16 June 2005 07:51 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
t_314159@yahoo.com writes:
> Hi,
> I have a text file that I must access many times during program
> execution (1000's of times, really!) and I *always* only need to change
> the the text on the 12th line of the file. My question, how to
> efficiently access and alter the text of ONLY the 12th line without
> altering even a single space or comma on any of the rest of the lines?
> And did I mention fast since i've got to loop through this many times?

If you can keep each line a fixed record size, then it might be
easiest to write lines 1-11, use POINT_LUN to determine the file
pointer position, and then write the rest of the file.

After that, you can open the file in update mode, (OPENU), and
POINT_LUN directly to the position of line 12, rewrite it, and
proceed. However, this procedure only works if line 12 has a fixed
record size.

Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How does IDL find functions?
Next Topic: ASCII read problem

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

Current Time: Wed Oct 08 17:54:30 PDT 2025

Total time taken to generate the page: 0.00250 seconds