when i open a file for output or input whats the function to make sure there were no problems opening it?

like
open "C:\Jayiscool.txt" for ouput as #1
?

i know its dumb but i cant seem to find an answer..

thanks in advance for any help

~Jay