Beispiel #1
0
        // Main Program
        static void Main(string[] args)
        {
            /* file names/locations for input and output text files */
            string InputFileLocation  = "./unsorted-names-list.txt";
            string OutputFileLocation = "./sorted-names-list.txt";

            try {
                /* Instantiate reader and retrieve output data */
                ListReader myListReader = new ListReader(InputFileLocation);
                string     MyData       = myListReader.OutputList();

                /* Write output to text file */
                StreamWriter sw = new StreamWriter(OutputFileLocation);
                sw.Write(MyData);
                sw.Close();

                /* Write output to console (and wait to exit) */
                Console.Write(MyData);
                Console.Write("\nPress any key to exit");
                Console.ReadKey();
            } catch (FileNotFoundException e) {
                Console.WriteLine(e.Message);
                Console.ReadKey();
            }
        }
Beispiel #2
0
        // Main
        static void Main(string[] args)
        {
            string InputFileLocation  = "../../../unsorted-names-list.txt";
            string OutputFileLocation = "../../../sorted-names-list.txt";
            string MyData             = "";

            ListReader myListReader = new ListReader(InputFileLocation);

            MyData = myListReader.OutputList();

            StreamWriter sw = new StreamWriter(OutputFileLocation);

            sw.Write(MyData);
            sw.Close();

            Console.Write(MyData); // output to console
            Console.Write("\nPress any key to exit");
            Console.ReadKey();
        }