Re: 64 bit integers (accessing files > 4Gb)
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Jan 31, 2007
- 471 views
Chris Bensler wrote: > > How do I access file data > 4Gb? > > The Windows API has SetFilePointerEx() but it requires large integers. > Is it possible to deal with large ints in Eu using atoms? > > Chris Bensler > ~ The difference between ordinary and extraordinary is that little extra ~ > <a href="http://empire.iwireweb.com">http://empire.iwireweb.com</a> - Empire > for Euphoria I didn't test this, but.... In the wrapper for your routine, replace the large_integer by a C_LONG and a C_ULONG. Then, pass the high dword in the C_LONG and the low dword in the C_LONG, both using atoms as usual. This results in
constant kernel32=open_dll("kernel32.dll"), sfpx=define_c_func(kernel32,"SetFilePointerEx", {C_POINTER,C_LONG,C_ULONG,C_POINTER,C_ULONG},C_BOOL)
You'd pass 5 atoms to c_func() when calling the function. You'd also poke4() 2 atoms at the place pointed to by the 4th arg, which is the lpNewFilePointer parameter. If the large integer is pushed on the stack, which I expect on 32 bit machines, this hack should work, since it generates the stack layout the routine expects. Perhaps using a "+" to force a _cdecl call is safer. Again, I haven't tested this... HTH CChris