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. 7 2566
In article <44***********************@news.wanadoo.fr>,
Hercule POIROT <he************@dev.nul> wrote: Could you please write for me the simplest portable c program that handles 64 bit file access.
That depends what you mean by "portable". No matter what you do,
you aren't going to be able to use 64 bit file access on filesystems
that are only 32 bit (or less.)
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 ?
If you want to use gcc and glibc, then you are asking questions
about *non*-portable facilities, and you should ask them in a gnu
newsgroup.
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer
Hercule POIROT wrote: Hello !
Could you please write for me the simplest portable c program that handles 64 bit file access.
No such creature, if we're talking about standard C.
I want to use only high-level functions (of section 3 : libraries) from glibc/libc6.
That ports to many systems, if by no means all.
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 ?
The answer to all your questions is: ask in a more appropriate newsgroup,
like comp.unix.programmer. This has nothing to do with standard C. (64-bit
file access is defined by POSIX as well.)
<snip> Sincerely, H.P.
And for a detective of your renown, I would have expected you to find that
out on your own. :-)
S.
On Mon, 1 May 2006 15:55:30 UTC, Hercule POIROT
<he************@dev.nul> wrote: 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.
glibc is NOT a standard C library. It is itself highly system
dependant. So ask in a group matching your target system.
C has no idea of files, directories, disks or other devices. The only
C knows of is streams. So again, ask in a group matching to your
system.
--
Tschau/Bye
Herbert
Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
Herbert Rosenau wrote:
<snip> C has no idea of files, directories, disks or other devices. The only C knows of is streams.
Untrue; C certainly does have a notion of files (in addition to streams), as
evidenced by section 7.19 of the standard (which describes <stdio.h>). It is
true that most platforms have a more detailed implementation of files than
is covered by standard C, of course.
S.
Skarmander a écrit : Herbert Rosenau wrote: <snip> C has no idea of files, directories, disks or other devices. The only C knows of is streams. Untrue; C certainly does have a notion of files (in addition to streams), as evidenced by section 7.19 of the standard (which describes <stdio.h>). It is true that most platforms have a more detailed implementation of files than is covered by standard C, of course.
S.
Thanks.
I'm pleased that you feel interested in my problem.
Furthermore, programmers are not so stupid as to have sclattered their
efforts amongst several different standards or interfaces about the
single topic of 64-bit file access ; most of them know of the POSIX
standard ;-)
Since I want to talk about portable C code, I mean to develop for a
target that has a POSIX-compliant stdio library.
In addition, is talking about functional and as portable as feasible C (
but non pure-C ) source code out of the scope of this newsgroup ?
We could even say that an int has no size in C since it is
platform-dependent !!!
I think such POSIX-compliant standard C libraries are commonplace under
*nix environments ; following your advice, I've made a more appropriate
post.
If, let's say in near future, MS Windows provides us with a Standard C
Library that is POSIX-compliant towards 64-bit file access, couldn't we
say that today's C language and its standard library are the common
denominator of accessing 64-bit files under all these OSes : UNIX,
Linux, *BSD, MS Windows, and so on ... ?
Can you all really evoke C programming without its standard libraries ?
What about access to 64-bit files under a 32-bit platform that uses a
64-bit-aware filesystem; and its coding in C with / APPROPRIATE standard
libraries under APPROPRIATE OSes ?
Thanks for developing a bit WHERE my problem is beyond the scope of this
newsgroup.
Bye,
H.P.
In article <44***********************@news.wanadoo.fr>,
Hercule POIROT <he************@dev.nul> wrote: Furthermore, programmers are not so stupid as to have sclattered their efforts amongst several different standards or interfaces about the single topic of 64-bit file access ; most of them know of the POSIX standard ;-)
Except for the OS functions that predate the standard, that
are in the operating systems of companies that developed the
ideas that the standards were derived from...
Since I want to talk about portable C code, I mean to develop for a target that has a POSIX-compliant stdio library.
In addition, is talking about functional and as portable as feasible C ( but non pure-C ) source code out of the scope of this newsgroup ?
Yes. In this newsgroup we interpret programs in terms of the
existing C standards, and generally consider as off-topic any
program whose source relies upon features not found in those
standards.
If there is any call to a routine whose standard-C
compliant source is not given and whose -exact- semantics
is not documented, then we generally assume that the purpose
of said routine is to remove all files, launch a nuclear bomb,
and divide by zero -- and if those things haven't happened yet,
we presume that it is only due to bugs in the implementation.
We could even say that an int has no size in C since it is platform-dependent !!!
No, it just doesn't have a -fixed- size in C. The C standards
make it clear that it must be able to hold at least 32767,
but the C standards are agnostic as to whether that's one
byte or two, and agnostic about whether 1<<31-1 is one, two,
or four bytes. {Hmmm, let's see, if a char was 12 bits long,
then 1<<31-1 could be represented in 3 bytes, so sizeof(int) could
possibly even be 3.}
If someone were to give you instructions to "Put on your shoe
and kick the football", then would you say that your shoe has
no size because it is wearer-dependant ?
If, let's say in near future, MS Windows provides us with a Standard C Library that is POSIX-compliant towards 64-bit file access, couldn't we say that today's C language and its standard library are the common denominator of accessing 64-bit files under all these OSes : UNIX, Linux, *BSD, MS Windows, and so on ... ?
No, today's "standard library" for C knows nothing about 64 bit
files, and there are still numerous Unices that have no 64 bit files.
Can you all really evoke C programming without its standard libraries ?
POSIX is not a C standard library. POSIX is an OS implementation
library which is an add-on.
What about access to 64-bit files under a 32-bit platform that uses a 64-bit-aware filesystem; and its coding in C with / APPROPRIATE standard libraries under APPROPRIATE OSes ?
This newsgroup works with the C standard library. Libraries
belonging to other standards are off-topic here (unless they are
coded in standard C without extensions.)
--
Is there any thing whereof it may be said, See, this is new? It hath
been already of old time, which was before us. -- Ecclesiastes
Hercule POIROT wrote: Skarmander a écrit : Herbert Rosenau wrote: <snip> C has no idea of files, directories, disks or other devices. The only C knows of is streams. Untrue; C certainly does have a notion of files (in addition to streams), as evidenced by section 7.19 of the standard (which describes <stdio.h>). It is true that most platforms have a more detailed implementation of files than is covered by standard C, of course.
S.
Thanks.
I'm pleased that you feel interested in my problem.
Furthermore, programmers are not so stupid as to have sclattered their efforts amongst several different standards or interfaces about the single topic of 64-bit file access ; most of them know of the POSIX standard ;-)
Since I want to talk about portable C code, I mean to develop for a target that has a POSIX-compliant stdio library.
Try running your POSIX compliant code on an Atari ST or an embedded
system. You will even find problems trying to run it on DOS or Windows!
In addition, is talking about functional and as portable as feasible C ( but non pure-C ) source code out of the scope of this newsgroup ?
This group only deals with C as defined by the C standard. For POSIX you
have comp.unix.programmer.
We could even say that an int has no size in C since it is platform-dependent !!!
It has a minimum size, it is at least 16 bits and has a range of at
least -32767 to +32767
I think such POSIX-compliant standard C libraries are commonplace under *nix environments ; following your advice, I've made a more appropriate post.
If, let's say in near future, MS Windows provides us with a Standard C Library that is POSIX-compliant towards 64-bit file access, couldn't we say that today's C language and its standard library are the common denominator of accessing 64-bit files under all these OSes : UNIX, Linux, *BSD, MS Windows, and so on ... ?
There are more systems than are dreamt of in your philosophy...
Can you all really evoke C programming without its standard libraries ?
Non-hosted systems are required to have only very minimal library
support (a few headers and no functions). Even hosted implementations
are not required to support any additional items POSIX specifies.
What about access to 64-bit files under a 32-bit platform that uses a 64-bit-aware filesystem; and its coding in C with / APPROPRIATE standard libraries under APPROPRIATE OSes ?
If it just works with standard file streams fine, otherwise you need to
use something specific to the OS in question.
Thanks for developing a bit WHERE my problem is beyond the scope of this newsgroup.
As you want to be portable across POSIX ask in comp.unix.programmer.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro: http://clc-wiki.net/wiki/Intro_to_clc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
...
|
by: BT Openworld |
last post by:
I have just had to upgrade to Access 2003 as Access 97 EMail (SendObject)
doesn't work when loaded on Windows XP. I'm finding my way around Access
2003 but my biggest problem is getting...
|
by: Corepaul |
last post by:
Missing Help Files
When I enter "recordset" as the keyword and search the Visual Basic Help index,
I get many topics of interest in the resulting list. But there isn't any
information available...
|
by: Tim Hunter |
last post by:
Hi,
I am using Access 2003 with WinXP/sp#2.
I have built a Help file using MS HTML Help Workshop that includes a TOC
as well as an Index file. My problem is how do I call this from Access.
I do...
|
by: Microsoft News |
last post by:
I have a web server sitting on computer 1, (QA1). Out on the network on my
main server I have a folder with a zip file in it. All I want is for the
web services that are on the web server to pick...
|
by: Siegfried Heintze |
last post by:
I refered the engineer at my hosting service to
http://support.microsoft.com/default.aspx?scid=kb;en-us;825738 where he
tried to follow the directions there.
He said there was no such file:...
|
by: James Radke |
last post by:
Hello,
I have a multithreaded windows NT service application (vb.net 2003) that I
am working on (my first one), which reads a message queue and creates
multiple threads to perform the processing...
|
by: skumar434 |
last post by:
i need to store the data from a data base in to structure
.............the problem is like this ....suppose there is a data base
which stores the sequence no and item type etc ...but i need only...
|
by: O |
last post by:
I need to do some lookups and updates on some legacy Access 2.0 files
(they've from another vendor and I'm not in a position to update them).
I was successful using VB6, but I've moved on to VS...
|
by: sara |
last post by:
I have a friend doing some pro-bono work for a non-profit that does
job training for distressed kids under DCSS care. He asked me for
code to do the following (he's using A2003).
I can't find...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| | |