![]() If an exception is caught by the CLR, one of the following results may occur depending on your CLR configuration: The Common Language Runtime (CLR) catches exceptions not handled by catch blocks. StreamReader^ sr = File::OpenText("data.txt") Ĭonsole::WriteLine("The first line of this file is '") Three catch blocks catch the exceptions and handle them by displaying the results to the console. Since the code might throw any of three exceptions, it's placed in a try block. In the following example, a StreamReader opens a file called data.txt and retrieves a line from the file. ![]() Each catch block includes the exception type and can contain additional statements needed to handle that exception type. Place any code statements that might raise or throw an exception in a try block, and place statements used to handle the exception or exceptions in one or more catch blocks below the try block. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |