Add open file function

Add open file function.