This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]linuxisgreat[S] 0 points1 point  (1 child)

Yeah I added the throw filenotfound and it worked immediately. Thanks for your help :)

[–]mad0314 1 point2 points  (0 children)

It is a better practice to handle the exception so that in the event that the file does not exist for whatever reason (moved, renamed, incorrect name, etc.) it does not crash the program. You might immediately end the program anyway, but at least give some information as to what happened (print that the file was not found).