Won't "fread" also return _1 for an existing file that cannot be read?
fread 'C:\pagefile.sys' _1 However, in this case, it does seem consistent with "fexist": fexist 'C:\pagefile.sys' 0 (This file does exist.) Well, then in the more elaborate case: NB. In session 1: flnm=. 'C:\amisc\somefile.txt' fopen=: [:1!:21< NB. Open file named by y. fclose=: [:1!:22< NB. Close file name or number y. flock=: 1!:31 NB. File number, index, length of region to lock fid=. fopen flnm flock fid,0,<:fsize fid NB. Lock the file... 1 NB. Subsequently, in another session: 1!:44 'C:\amisc\' fexist 'somefile.txt' 1 fread 'somefile.txt' _1 The two are not equivalent. On Thu, Dec 30, 2010 at 2:58 PM, Don Guinn <[email protected]> wrote: > If the purpose is to read the file if it exists, just go ahead and use > fread > which will return _1 if the file does not exist. Just test for _1 after the > fread. > ... > -- Devon McCormick, CFA ^me^ at acm. org is my preferred e-mail ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
