I need to use StreamReader to read a .txt file on a console application, then create a new file or backup with a different name but same content. The problem is i cant figure out how to use the content from the first file to place into the new one. (This is for a school thing and im new to C#)
using System;
using System.IO;
namespace UserListCopier
{
class Program
{
static void Main()
{
string fineName = "zombieList.txt";
StreamReader reader = new StreamReader(fineName);
int lineNumber = 0;
string line = reader.ReadLine();
while (line != null) {
lineNumber++;
Console.WriteLine("Line {0}: {1}", lineNumber, line);
line = reader.ReadLine();
}
StreamWriter writetext = new StreamWriter("zombieListBackup.txt");
writetext.Close();
System.Console.Read();
reader.Close();
}
}
}