Code:using System; using System.IO; namespace FileExperiment { class Program { const string INPUT = "\\Projects\\FileExperiment\\FileExperiment\\Test.txt"; const string OUTPUT = "\\Projects\\FileExperiment\\FileExperiment\\outfile.txt"; static int data = 4; static string[] words = new string[data + 1]; static StreamReader fileIn; static StreamWriter fileOut; static void Main() { fileIn = File.OpenText(INPUT); fileOut = File.CreateText(OUTPUT); InputData(); for (int i = 0; i < data; i++) fileOut.WriteLine("{0}",words[i]); Console.ReadLine(); } static void InputData() { string word; int i = 0; while ((word = fileIn.ReadLine()) != null) { words[i] = word; i++; } } } }
Can someone help me figure out why this code won't output from the input file?