(heavily off topic, just matter of personale taste) I suspected this would have been the proposed solution
I started to appreciate exceptions in my Java past, and I still use them in C++ even though my peers seem not to appreciate much having to enclose the opening of a file in a try block.. Instead I really don't like having to check a return code or the validity o a return value (like in this case): it breaks the natural flow of the code (while you read it, obviously when the code runs exceptions have the same effect) and I especially hate when you have to check the same thing multiple times. e.g: In C when you want to read a file: * you have to check the return value of the fopen function because it can break if the file doesn't exist (even though, on linux, it doesn't break when you pass to it a directory path) * you have to check the return value of the fread function because it can break for whatever reason (one randomly chosen: you are reading a directory on linux) * you have to check the return value of the fclose function because it can break if the disk is full How much better is it to just wrap everything in a try/catch(IOException) block and forget about details?
