Don Guinn wrote:
I ran into problems when using fdir (1!:0) when the files were larger than 2
gig. The size of the file is wrong as is documented. I addressed this by
using bigfiles and it worked well until I tried to get the size of a file
that was open by another application. Then bfsize_jbf_ fails. What confuses
me is that somehow 1!:0 can retrieve the size of the file (though incorrect)
even though it is open to another application. As best as I can tell all
file tools provided by Microsoft require file handles implying that the file
has been opened.
So how does 1!:0 get the file size for files open to other applications? It
would be nice if bigfiles could use the same technique.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


This worked for me:

FindFirstFile=: 'kernel32 FindFirstFileA i *c *'&cd
FindClose=: 'kernel32 FindClose i i'&cd

findd=:318$'a'
ffsize=:28+i.8
INVALID_HANDLE_VALUE=: _1

NB. =========================================================
NB.*fffsize v get file size using windows API
NB. form: fffsize file_path_name
fffsize=: 3 : 0
'fh ft fv'=. FindFirstFile y;findd
if. INVALID_HANDLE_VALUE~:fh do.
 r=.b32to64 ctoi"1]2 4$ffsize{fv
 FindClose fh
else.
 r=.''
end.
r
)

--
David Mitchell

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to