|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
line replacing ideashey 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 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 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 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 > > > |
|||||||||||||||||||||||