Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #1848

Re: Replacing text in a text file with VB6

From ralph <nt_consulting64@yahoo.net>
Newsgroups comp.lang.basic.visual.misc
Subject Re: Replacing text in a text file with VB6
Date 2011-02-06 21:19 -0600
Organization A noiseless patient Spider
Message-ID <fimuk6dv5t81ums021k1f52tkmets4bdst@4ax.com> (permalink)
References <c45da097-c1e0-4972-bae0-cad00813ca40@s28g2000prb.googlegroups.com> <iik7r9$18d$1@news.eternal-september.org> <d2a1f261-bbda-43f9-919b-c25c5349bafc@y4g2000prh.googlegroups.com> <iimdlf$37c$1@news.eternal-september.org> <4d4f2ab0@dnews.tpgi.com.au>

Show all headers | View raw


On Mon, 7 Feb 2011 10:10:58 +1100, "StrandElectric" <Strand@dummyspit>
wrote:

>
>"dpb" <none@non.net> wrote in message 
>news:iimdlf$37c$1@news.eternal-september.org...
>> jason@smkzone.com wrote:
>>> That seems a little complicated just to get the top 3 lines and change
>>> them.  Is there a way to get just those three lines, set each to a
>>> different variable, and change them one by one?  I'm using If
>>> statements to change it, so that, for example:
>> ...
>>
>> LINE INPUT # will do that.
>>
>> But, the thing is about sequential files is that....well, they're 
>> sequential.  So you'll still have to rewrite the whole file unless you get 
>> cute and read it as a binary and find the records and replace only the 
>> identical existing length.
>>
>
>Which leads me to throw a complete spanner in the works. I would do it by 
>using a random access file. You can then work on just the record you need. I 
>presume that the database approach uses just serial files.  I've always used 
>random myself, since 1980 (!) so I'm more comfortable with it. But don't let 
>that change your approach. I'm the greenest of the green and struggling 
>right now with vb.net (though I have got random access files working there 
>too!).  At the moment, I much prefer vb6, mainly for its excellent help 
>system and its support for printing, both of which are abysmal in vb.net! 
>

Not sure how that is a "complete spanner"?

There isn't any such thing as a "random access file". You can read the
data in a file sequentially or randomly. Sequential access implies
opening the file and advancing through it till you find the spot of
interest. Random access implies opening the file and moving directly
to a spot using a 'seek' instruction. 

Random access certainly has avantages over sequential access in terms
of speed and space for large files, however, both depend on knowing in
advance where to stop.

-ralph

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Replacing text in a text file with VB6 dpb <none@non.net> - 2011-02-06 09:10 -0600
  Re: Replacing text in a text file with VB6 "Henning" <computer_hero@coldmail.com> - 2011-02-08 00:20 +0100
    Re: Replacing text in a text file with VB6 ralph <nt_consulting64@yahoo.net> - 2011-02-07 18:12 -0600
      Re: Replacing text in a text file with VB6 "Henning" <computer_hero@coldmail.com> - 2011-02-08 01:27 +0100
  Re: Replacing text in a text file with VB6 "StrandElectric" <Strand@dummyspit> - 2011-02-07 10:10 +1100
    Re: Replacing text in a text file with VB6 ralph <nt_consulting64@yahoo.net> - 2011-02-07 21:18 -0600
      Re: Replacing text in a text file with VB6 "jason@smkzone.com" <jbodine1@yahoo.com> - 2011-02-08 10:06 -0800
    Re: Replacing text in a text file with VB6 ralph <nt_consulting64@yahoo.net> - 2011-02-06 21:19 -0600
      Re: Replacing text in a text file with VB6 "StrandElectric" <Strand@dummyspit> - 2011-02-08 12:31 +1100
      Re: Replacing text in a text file with VB6 ralph <nt_consulting64@yahoo.net> - 2011-02-07 18:31 -0600
      Re: Replacing text in a text file with VB6 GS <gs@somewhere.net> - 2011-02-06 22:29 -0500
      Re: Replacing text in a text file with VB6 "StrandElectric" <Strand@dummyspit> - 2011-02-08 10:58 +1100
  Re: Replacing text in a text file with VB6 "StrandElectric" <Strand@dummyspit> - 2011-02-10 05:29 +1100
  Re: Replacing text in a text file with VB6 "jason@smkzone.com" <jbodine1@yahoo.com> - 2011-02-07 08:33 -0800
    Re: Replacing text in a text file with VB6 "StrandElectric" <Strand@dummyspit> - 2011-02-08 07:14 +1100
      Re: Replacing text in a text file with VB6 ralph <nt_consulting64@yahoo.net> - 2011-02-07 15:03 -0600
    Re: Replacing text in a text file with VB6 dpb <none@non.net> - 2011-02-07 11:47 -0600
    Re: Replacing text in a text file with VB6 Helmut_Meukel <Helmut_Meukel@bn-hof.invalid> - 2011-02-09 12:09 +0100

csiph-web