By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,327 Members | 1,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,327 IT Pros & Developers. It's quick & easy.

line replacing ideas

P: n/a
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
Nov 1 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I'd check out the StreamReader and StreamWriter classes in the
documentation...

Steve

"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:96**********************************@microsof t.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

Nov 1 '06 #2

P: n/a
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

Nov 1 '06 #3

P: n/a
thanks for the tips everyone.

"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


Nov 3 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.