Consider the following code below in which for each entry in key.txt I add it to each line in plain.txt and write it to the output.txt.
Dim srKeyFile As New StreamReader("D:\Test\key.txt")
Dim srOutFile As New StreamWriter("D:\TestBial\output.txt")
Dim strKey, strPlain As String
While srKeyFile.Peek() >= 0
Dim srPlainFile As New StreamReader("D:\TestB\plain.txt")
strKey = srKeyFile.ReadLine()
Dim key As Integer = Integer.Parse(strKey)
While srPlainFile.Peek() >= 0
strPlain = srPlainFile.ReadLine()
Dim plain As Integer = Integer.Parse(strPlain)
srOutFile.WriteLine("" + (key + plain).ToString())
End While
srPlainFile.Close()
End While
srOutFile.Close()
Above I have to open and close the inner file on each iteration of the outer loop.Is there some way That I could position my pointer to beginning,each time I enter the inner loop for the file plain.txt