line replacing ideas

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
I'd check out the StreamReader and StreamWriter classes in the
documentation...

Steve
 
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
 
thanks for the tips everyone.

Tim Patrick said:
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
 
Back
Top