|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
KennyT
Joined: 02 Aug 2005 Posts: 317
|
Posted: Wed May 25, 2016 11:52 am Post subject: reading files > 4Gb |
|
|
Are there any plans for the @ functions (e.g. FPOS@) to support full 8-byte positioning?
K |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Wed May 25, 2016 3:07 pm Post subject: |
|
|
No but if you can give me a list of the relevant functions then it would not be a major task. |
|
Back to top |
|
|
KennyT
Joined: 02 Aug 2005 Posts: 317
|
Posted: Wed May 25, 2016 3:26 pm Post subject: |
|
|
OK,
I envisage as a minimum:
FPOS8@
RFPOS8@
And possibly:
READF8@
WRITEF8@
That'll do for starters!
tks
K |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Fri May 27, 2016 9:35 am Post subject: |
|
|
Paul,
The following is taken from my interface to the salford file i/o routines, where I have updated the file position to integer*8.
The byte_size could also be integer*8, should an individual record be larger than 2^31 bytes, although this is not as important.
Also the file handle (lunit) and error_code are integer*2, which could be changed to integer*4.
These routines provide all the functionality I use, apart from closef@, file_size8@ and erase@.
The changes, both needed and possible are:
rfpos@ need I*8:file_position
fpos@ need I*8:file_position
writef@ could have I*8:byte_size
readf@ could have I*8: byte_size, bytes_read
openrw@ could have I*4:lunit, error_code
doserr@
closef@
file_size8@ could have I*8:file_size
erase@
Code: | subroutine open_salford_io ( file_name, lunit, error_code )
!
! File I/O using Salford I/O library
!
character file_name*(*)
integer*2 lunit, error_code
!
lunit = -1
CALL openrw@ (file_name, lunit, error_code)
write ( *,*) 'OPEN : File = ', trim (file_name)
write ( *,*) 'OPEN : Handle =', lunit
write ( *,*) 'OPEN : Error code =', error_code
write (98,*) 'OPEN : File = ', trim (file_name)
write (98,*) 'OPEN : Handle =', lunit
write (98,*) 'OPEN : Error code =', error_code
if (error_code.ne.0) call doserr@ (error_code)
!
end subroutine open_salford_io
subroutine getpos_salford_io ( lunit, file_position )
!
! File I/O using Salford I/O library
!
integer*2 lunit, error_code
integer*8 file_position
!
call rfpos@ (lunit, file_position, error_code) ! get byte position, first is 0
if (error_code.ne.0) call doserr@ (error_code)
!
end subroutine getpos_salford_io
subroutine setpos_salford_io ( lunit, file_position )
!
! File I/O using Salford I/O library
!
integer*2 lunit, error_code
integer*8 file_position, new_position
!
call fpos@ (lunit, file_position, new_position, error_code) ! get byte position, first is 0
if (file_position.ne.new_position) write ( *,*) 'File position error', file_position, new_position
if (file_position.ne.new_position) write (98,*) 'File position error', file_position, new_position
if (error_code.ne.0) call doserr@ (error_code)
!
end subroutine setpos_salford_io
subroutine write_salford_io ( lunit, buffer, byte_size, file_position )
!
! File I/O using Salford I/O library
!
integer*2 lunit, error_code
integer*4 byte_size
integer*8 file_position
real*8 buffer(*)
!
if (file_position /= -1) call setpos_salford_io ( lunit, file_position )
!
call writef@ (buffer, lunit, byte_size, error_code)
if (error_code.ne.0) call doserr@ (error_code)
!
end subroutine write_salford_io
subroutine read_salford_io ( lunit, buffer, byte_size, file_position )
!
! File I/O using Salford I/O library
!
integer*2 lunit, error_code
integer*4 byte_size, bytes_read
integer*8 file_position
real*8 buffer(*)
!
if (file_position /= -1) call setpos_salford_io ( lunit, file_position )
!
call readf@ (buffer, lunit, byte_size, bytes_read, error_code)
if (bytes_read.ne.byte_size) write ( *,*) 'Bytes read error', byte_size, bytes_read
if (bytes_read.ne.byte_size) write (98,*) 'Bytes read error', byte_size, bytes_read
if (error_code.ne.0) call doserr@ (error_code)
!
end subroutine read_salford_io
|
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Mon May 30, 2016 6:54 am Post subject: |
|
|
Kenny and John: Thanks for the feedback. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Mon Jun 06, 2016 10:52 am Post subject: |
|
|
The following undocumented Win32 routines have now been ported to 64 bits for the next release: FPOSLONG@, RFPOSLONG@ and FPOS_EOFLONG@. These are similar to FPOS@, RFPOS@ and FPOS_EOF@ but take INTEGER*8 position arguments. Note that other arguments are still INTEGER*2.
READFLONG@ and WRITEFLONG@ don't exist at the moment but hopefully are less urgent. |
|
Back to top |
|
|
StamK
Joined: 12 Oct 2016 Posts: 159
|
Posted: Thu Dec 20, 2018 12:53 am Post subject: |
|
|
Would it be possible to now add also READFLONG@ and WRITEFLONG@? I checked in 8.40 and they don't seem to be there. Thanks |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Thu Dec 20, 2018 11:32 am Post subject: |
|
|
I have added these routines and a new DLL can be downloaded from here...
https://www.dropbox.com/s/ak5r1ghhiq0pml5/newDLLs29.zip?dl=0
Here is some sample code used for testing...
Code: | program main
implicit none
integer(4),parameter::N = 4294967296_4 !4GB
character(len=N) buffer
integer(2) handle,ierror
integer(4) bytes_read
call OPENR@("xxxxx", handle, ierror)
call READFLONG@(buffer, handle, N, bytes_read, ierror)
call CLOSEF@(handle, ierror)
call OPENW@("zzzzzz", handle, ierror)
call WRITEFLONG@(buffer, handle, bytes_read, ierror)
call CLOSEF@(handle, ierror)
end |
|
|
Back to top |
|
|
StamK
Joined: 12 Oct 2016 Posts: 159
|
Posted: Tue Jan 22, 2019 11:11 pm Post subject: |
|
|
I forgot to thank you Paul for the quick fix. I can confirm that the calls are there now. Thanks again |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|