Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace ConsoleApplication5
- {
- class Program
- {
- static void Main(string[] args)
- {
- while (true)
- {
- Console.WriteLine(">Enter File to open.");//Prompt user for file name
- try
- {
- if (!File.Exists(Console.ReadLine())) ;
- throw new FileNotFoundException();//Check for errors
- }
- catch (FileNotFoundException)
- {
- Console.WriteLine("You stuffed up!"); //Display error message
- }
- }
- System.Diagnostics.Process.Start(@Console.ReadLine()); //set valid reply response
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement