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


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

Re: Replacing text in a text file with VB6

From "StrandElectric" <Strand@dummyspit>
Newsgroups comp.lang.basic.visual.misc
References (1 earlier) <iik7r9$18d$1@news.eternal-september.org> <d2a1f261-bbda-43f9-919b-c25c5349bafc@y4g2000prh.googlegroups.com> <iimdlf$37c$1@news.eternal-september.org> <12570ee9-67ce-4bd3-abb8-d994427c73ce@w7g2000pre.googlegroups.com> <iitslg$e9n$1@news.eternal-september.org>
Subject Re: Replacing text in a text file with VB6
Date 2011-02-10 05:29 +1100
Message-ID <4d52dd3c$1@dnews.tpgi.com.au> (permalink)

Show all headers | View raw


"Helmut_Meukel" <Helmut_Meukel@bn-hof.invalid> wrote in message 
news:iitslg$e9n$1@news.eternal-september.org...
> jason@smkzone.com came up with this:
>> Here's why I'm having trouble with doing it this way:
>>
>> the lengths of line 2 and line 3 will always be constant. A SSN is 9
>> numbers and the employee number will always be 4 numbers.  But names
>> are variable lengths. Plus, not every employee will have been hired at
>> the exact same time, so the number of clock in and clock out
>> timestamps is bound to be different from file to file, making for
>> different file lengths.  So wouldn't getting byte lengths and string
>> lengths, even with the Split function be useless in this context,
>> since those things change from one employee file to the next?
>>
>
> Jason, you should really look-up Split in Online Help.
> The length of the substrings between the separators (e.g. CRLF) doesn't
> matter, Split will return an array of strings.
>
> However, given your scenario with different lengths for the name,
> you'll always have to read and write back the whole text file.
> You could avoid to overwrite the whole file if you always use the same
> length for the name (all names padded with blanks to the same length).
> Then it's possible to change the name by just overwriting these bytes in
> the file.
>
> Helmut.
>
The random access method avoids all that (albeit that there is some wasted 
file space -- but then disc capacities are hardly restrictive these days) 

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