H
Hercule POIROT
Hello !
Could you please write for me the simplest portable c program that
handles 64 bit file access.
I want to use only high-level functions (of section 3 : libraries) from
glibc/libc6.
I need answer to the following questions :
- Do I have to invoke gcc with the -D_FILE_OFFSET_BITS=64 argument ?
- Do I have to define a macro likewise : #define _FILE_OFFSET_BITS 64 ?
- Where can I place this macro; before the inclusion of stdlib or stdio ?
I want the program to perform the following tasks :
- Opening of a (long) data file with the appropriate mode.
- Seek of arbitrary 64-bit offset.
- Read the current (64-bit) offset.
- read/write a block of data.
- Seek of the end of the file, using an offset 0 and the seek mode SEEK_END.
- Closing of the file.
Will this program work on Debian GNU/Linux stable 3.1 (sarge) on an
IA-32 architecture machine with the precompiled binary packages for the
kernel 2.6.15, glibc, the gcc suite and binutils ?
I've written a full program of my own that performs well 32-bit file
operations and I'm stuck when I try to adapt it to handle 64-bit files.
Any walkthrough to adapt an existing program likewise ?
Thank you.
Sincerely,
H.P.
Could you please write for me the simplest portable c program that
handles 64 bit file access.
I want to use only high-level functions (of section 3 : libraries) from
glibc/libc6.
I need answer to the following questions :
- Do I have to invoke gcc with the -D_FILE_OFFSET_BITS=64 argument ?
- Do I have to define a macro likewise : #define _FILE_OFFSET_BITS 64 ?
- Where can I place this macro; before the inclusion of stdlib or stdio ?
I want the program to perform the following tasks :
- Opening of a (long) data file with the appropriate mode.
- Seek of arbitrary 64-bit offset.
- Read the current (64-bit) offset.
- read/write a block of data.
- Seek of the end of the file, using an offset 0 and the seek mode SEEK_END.
- Closing of the file.
Will this program work on Debian GNU/Linux stable 3.1 (sarge) on an
IA-32 architecture machine with the precompiled binary packages for the
kernel 2.6.15, glibc, the gcc suite and binutils ?
I've written a full program of my own that performs well 32-bit file
operations and I'm stuck when I try to adapt it to handle 64-bit files.
Any walkthrough to adapt an existing program likewise ?
Thank you.
Sincerely,
H.P.