To make a program handle such large files,are there any specail commands needed?? Or can you just use standard open and close commands(for files) with standard read and write commands???
An example of problem i get with ctorrent and sfs/02 when downloading a +4gb file.
Ctorrent first makes the file 325mb big and after some DL it frequently puts out the messages
error, failed to seek to 18446744072280801280 on file "xbx.iso": Illegal seek error, failed to seek to 18446744072280817664 on file "xbx.iso": Illegal seek error, failed to seek to 18446744072280834048 on file "xbx.iso": Illegal seek error, failed to seek to 18446744072280850432 on file "xbx.iso": Illegal seek error, failed to seek to 18446744072280866816 on file "xbx.iso": Illegal seek error, failed to seek to 18446744072280883200 on file "xbx.iso": Illegal seek error, failed to seek to 18446744072280899584 on file "xbx.iso": Illegal seek
Use ChangeFilePosition(), GetFilePosition(), GetFileSize(), ChangeFileSize() instead of old Seek() function. (Seek() is only 32bit and it's now deprecated. Those others are 64bit.) (Remember to use int64 variables with those.) Open(), Close(), Read() and Write() are still ok. (Well OS4 only. I don't know OS3.x.)
Rock lobster bit me - so I'm here forever X1000 + AmigaOS 4.1 FE "Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
To make a program handle such large files,are there any specail commands needed?? Or can you just use standard open and close commands(for files) with standard read and write commands???
Open(), Close(), Read() and Write() are still the same, but for example most features of Seek() can't be used and ExAll() can't return file sizes > 4 GB. Old software which only accesses files sequentially and doesn't check the file size works with large files, but that's not much, everything else has to be changed to use the new 64 bit AmigaOS4 dos.library functions, or the 64 bit C library functions. On AmigaOS 3.x you can use the functions in the dos64 link library from my homepage instead.
Ok. I'm working on a port to os4. I see it uses fseek and lseek. Seems like standard open close commands for file opening/closing. Not searched all files yet though!
But why can't the original commands be adjusted to work with big files without any changes to the commands itselves? if you understood that? :)
Ok. I'm working on a port to os4. I see it uses fseek and lseek.
You have to use fseeko64() and _lseek64() instead, but that requires a new SDK ...
Quote:
But why can't the original commands be adjusted to work with big files without any changes to the commands itselves? if you understood that? :)
Old functions like IDOS->Seek(), the C library fseek(), etc., use 32 bit arguments and return values for the offset, if you would change them to 64 bit you'd break all old software passing 32 bit values to them or expecting 32 bit return values. New functions with 64 bit arguments and/or return values, which are only used by new software, have to be used instead.
EDIT: Maybe you could create a small link library that contains stubfunctions for the 64 bit filefunktions. Something like your libdos64, but for newlib. Its ugly, but it should help Antique with ctorrent.