Mega Code Archive
Open a file with exception handling
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;
}