[2008]Reading lines from one text file and write it out to another text file
Hi.
I need to read from one text file and then write it out to another text file.
IE.
Read the all the lines in file 'HCR.tmp' and write all the line from 'HCR.tmp' to 'HIVECLS.inf'
Here is the code i have been trying to use put im getting a problem with 'LINES' in bold.
Im getting Value of type '1-dimensional array of string' cannot be converted to 'string' error
Code:
Private Sub HiveCls()
Dim lines() As String = IO.File.ReadAllText("C:\SFE\Temp\HCR.tmp")
Dim CLSlines As New List(Of String)(IO.File.ReadAllLines("C:\SFE\Temp\HIVECLS.inf"))
For CLSindex As Integer = 0 To CLSlines.Count - 1
If CLSlines(CLSindex) = "[AddReg]" Then
CLSlines.Insert(CLSindex + 1, lines)
Exit For
End If
Next
IO.File.WriteAllLines("C:\SFE\Temp\HIVECLS.inf", CLSlines.ToArray())
End Sub
Many thanks for your help.
Worf
Re: [2008]Reading lines from one text file and write it out to another text file
This is what MSDN has to say about IO.File.ReadAllText.
Re: [2008]Reading lines from one text file and write it out to another text file
Thank you, will have a look.