Home All Groups Group Topic Archive Search About
Author
1 Nov 2006 2:51 PM
rodchar
hey all,
i have 2 notepad files and i want to replace every 3rd line in 1 of the
notepad files with the exact same line in the other notepad file. what's the
easiest way to do this?

thanks,
rodchar

Author
1 Nov 2006 5:00 PM
Steve Long
I'd check out the StreamReader and StreamWriter classes in the
documentation...

Steve

Show quoteHide quote
"rodchar" <rodc***@discussions.microsoft.com> wrote in message
news:96C5811B-446C-43EA-A74D-127D370F51B4@microsoft.com...
> hey all,
> i have 2 notepad files and i want to replace every 3rd line in 1 of the
> notepad files with the exact same line in the other notepad file. what's
> the
> easiest way to do this?
>
> thanks,
> rodchar
Author
1 Nov 2006 5:19 PM
Tim Patrick
Here's some pseudocode that may meet your needs.

   Dim position As Integer = 0

   Open the first file
   Open the second file
   Open the output file

   While (both input files still have data)
      Read in one line from both input files

      position += 1
      If ((position Mod 3) = 0) Then
         Write out line from second input file
      Else
         Write out line from first input file
      End If
   Loop

   Close all files

-----
Tim Patrick
Start-to-Finish Visual Basic 2005

Show quoteHide quote
> hey all,
> i have 2 notepad files and i want to replace every 3rd line in 1 of
> the
> notepad files with the exact same line in the other notepad file.
> what's the
> easiest way to do this?
> thanks,
> rodchar
Author
3 Nov 2006 4:22 PM
rodchar
thanks for the tips everyone.

Show quoteHide quote
"Tim Patrick" wrote:

> Here's some pseudocode that may meet your needs.
>
>    Dim position As Integer = 0
>
>    Open the first file
>    Open the second file
>    Open the output file
>
>    While (both input files still have data)
>       Read in one line from both input files
>
>       position += 1
>       If ((position Mod 3) = 0) Then
>          Write out line from second input file
>       Else
>          Write out line from first input file
>       End If
>    Loop
>
>    Close all files
>
> -----
> Tim Patrick
> Start-to-Finish Visual Basic 2005
>
> > hey all,
> > i have 2 notepad files and i want to replace every 3rd line in 1 of
> > the
> > notepad files with the exact same line in the other notepad file.
> > what's the
> > easiest way to do this?
> > thanks,
> > rodchar
>
>
>