FileStream fin; try { fin = new FileStream("test.dat", FileMode.Open); } catch(FileNotFoundException exc) { Console.WriteLine(exc.Message); return; } catch { Console.WriteLine("Cannot open file."); return; }