safeFileOpen           package:widgetTools           R Documentation

_A _f_u_n_c_t_i_o_n _t_h_a_t _c_h_e_c_k_s _t_o _s_e_e _i_f _a _c_o_n_n_e_c_t_i_o_n _c_a_n _b_e _m_a_d_e _t_o _a
_g_i_v_e_n _f_i_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     This function checks to see if a given file name exists. If so,
     the function returns a connection to the file. Otherwise, it
     returns "fileName doest exist".

_U_s_a_g_e:

     safeFileOpen(fileName)

_A_r_g_u_m_e_n_t_s:

fileName: 'fileName' a character string for the name of a file to which
          a connection is to be oppened

_D_e_t_a_i_l_s:

     When this function is used, users have to make sure to check to
     see if the returnd object inherits object "connection". Otherwise,
     the file doest not exist or a connection has not be made.

_V_a_l_u_e:

     The function returns a connection object that inherits class
     "connection" if the file exists and is opend. Otherwise, the
     string "fileName doest not exist"

_N_o_t_e:

     This function is no placed here to be used by various widgets. May
     be mored to a more suitable place later

_A_u_t_h_o_r(_s):

     Jianhua Zhang

_S_e_e _A_l_s_o:

     'file'

_E_x_a_m_p_l_e_s:

     write("A test file", "testFile4safeFileOpen")
     tt <- safeFileOpen("testFile4safeFileOpen")
     inherits(tt, "connection")
     unlink("testFile4safeFileOpen")
     tt <- safeFileOpen("testFile4safeFileOpen")
     inherits(tt, "connection")

