473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Where could I find function body of "fseek()" and "ftell()"

Hey,
In head file 'stdio.h', I only find the prototype of these two function but
no body.
Could someone pls tell me where their bodies are ?

--------------
Life is magical.
Aug 25 '06 #1
21 2591
Chen ShuSheng wrote:
Hey,
Hey
In head file 'stdio.h', I only find the prototype of these two function but
no body.
That's how it works , include headers contain function
prototypes not definitions.
Could someone pls tell me where their bodies are ?
In the files of the person or organization who wrote
the C library you use.That person or organization may
or may not have decided to make these definitions
publically available. If for example you're using the GNU
compiler then the source will be publically available (but I
don't know where off top of my head). With other implementations
it may not. So if you tell us which implementation you're
using we might be able to tell you or direct you to an
appropriate newsgroup.

Spiros Bousbouras

Aug 25 '06 #2
Chen ShuSheng wrote:

(about fseek and ftell)
Hey,
In head file 'stdio.h', I only find the prototype of these two function but
no body.
That's how it's supposed to be.
Could someone pls tell me where their bodies are ?
Supposing we could, what difference would it make to whatever
you want to do? Remember that the code for these functions is
implementation-specific.

If you want to find out what they're /supposed/ to do, read
their descriptions in the Standard or man pages or some
appropriate C book.

--
Chris "seeker" Dollin
The "good old days" used to be much better.

Aug 25 '06 #3

<sp****@gmail.com>
??????:11**********************@b28g2000cwb.google groups.com...
Chen ShuSheng wrote:
>Hey,

Hey

don't know where off top of my head). With other implementations
it may not. So if you tell us which implementation you're
using we might be able to tell you or direct you to an
appropriate newsgroup.

Spiros Bousbouras
My implementation evironment is : Borland TC2.0.
Could you explain what is implementation-specific? I am not sure of that.
Aug 25 '06 #4
Chen shuSheng wrote:
<sp****@gmail.com>
??????:11**********************@b28g2000cwb.google groups.com...
Chen ShuSheng wrote:
Hey,
Hey

don't know where off top of my head). With other implementations
it may not. So if you tell us which implementation you're
using we might be able to tell you or direct you to an
appropriate newsgroup.

Spiros Bousbouras
My implementation evironment is : Borland TC2.0.
Could you explain what is implementation-specific? I am not sure of that.
What is implementation specific is whether the source code of
the standard library is publicly available or not. In your case I
suspect it isn't but I'm not 100% certain.

Spiros Bousbouras

Aug 25 '06 #5

<sp****@gmail.com>
??????:11**********************@i42g2000cwa.google groups.com...
Chen shuSheng wrote:
><sp****@gmail.com>
??????:11**********************@b28g2000cwb.googl egroups.com...
Chen ShuSheng wrote:
>
What is implementation specific is whether the source code of
the standard library is publicly available or not. In your case I
suspect it isn't but I'm not 100% certain.

Spiros Bousbouras
If the standard library is not publicly available, where the compiler should
go to find the function body? Iam curious.
Aug 25 '06 #6
Chen shuSheng wrote:
<sp****@gmail.com>
??????:11**********************@i42g2000cwa.google groups.com...
>Chen shuSheng wrote:
>><sp****@gmail.com>
??????:11**********************@b28g2000cwb.goog legroups.com...
Chen ShuSheng wrote:

What is implementation specific is whether the source code of
the standard library is publicly available or not. In your case I
suspect it isn't but I'm not 100% certain.

Spiros Bousbouras
If the standard library is not publicly available, where the compiler should
go to find the function body?
Typically the compiler doesn't /need/ the function body. Some kind soul has
compiled the code already and put that code somewhere that the implementation
can easily find it.

[The `kind soul` might have been the compiler vendor, as part of delivering
the compiler; or it might be the operating system provider, who may have
made an implementation of the C standard library available by default;
or it /could/ be that the compiler recompiles standard library functions
on demand, in which case it can know what the function body is without
it being anywhere "publically available".]
Iam curious.
Yes.

--
Chris "seeker" Dollin
"The path to the web becomes deeper and wider" - October Project

Aug 25 '06 #7
"Chen ShuSheng" <cs**********@163.comwrites:
Hey,
In head file 'stdio.h', I only find the prototype of these two function but
no body.
Could someone pls tell me where their bodies are ?
Well, I certainly didn't throw the bodies in the creek behind the mill.


You aren't going to check there, are you?

--
Andrew Poelstra <http://www.wpsoftware.net/projects>
To reach me by email, use `apoelstra' at the above domain.
"Do BOTH ends of the cable need to be plugged in?" -Anon.
Aug 25 '06 #8
Chen ShuSheng wrote:
Hey,
In head file 'stdio.h', I only find the prototype of these two function but
no body.
Could someone pls tell me where their bodies are ?
This is a common question that comes up when one is learning C. I
certainly puzzled about it for a while, before I realised with dismay
that the source code of my C library was not available.

You see, some people, probably either the makers of the compiler or the
operating system or the hardware, have a copy of the function bodies but
they don't want to give it away. So, they compile the functions into a
library and just distribute the compiled code. You have no way to get to
the actual implementation since it's already compiled.

However, there are some kind people who created C libraries and made the
source code freely available. Free software projects like GNU's glibc
and newlib come to mind. You can even browse the source on the web these
days, through CVS gateways.

Standard C libraries have been written by many different companies and
people over the years, and some are more portable than others. Reading
through code like fseek and ftell's may involve a lot of system-specific
function calls.

--
Simon.
Aug 25 '06 #9
Chen shuSheng wrote:
<sp****@gmail.com>
??????:11**********************@i42g2000cwa.google groups.com...
>Chen shuSheng wrote:
>><sp****@gmail.com>
??????:11**********************@b28g2000cwb.goog legroups.com...
Chen ShuSheng wrote:
>What is implementation specific is whether the source code of
the standard library is publicly available or not. In your case I
suspect it isn't but I'm not 100% certain.

Spiros Bousbouras

If the standard library is not publicly available, where the compiler should
go to find the function body? Iam curious.

It's time to learn about object code linkage.
Aug 25 '06 #10
Chen shuSheng wrote:
>
.... snip ...
>
If the standard library is not publicly available, where the
compiler should go to find the function body? Iam curious.
It doesn't need the source, just the compiled object code, which is
in the library.

--
Some informative links:
news:news.announce.newusers
http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote.html
Aug 25 '06 #11
sp****@gmail.com wrote:

<snip>
publically available. If for example you're using the GNU
compiler then the source will be publically available (but I
don't know where off top of my head). With other implementations
<OT NIT>
The GNU compiler, gcc, is just a compiler not a complete implementation
and does *not* include the library. Normally gcc uses whatever C library
the OS provides and the source code for that library may well not be
available.
--
Flash Gordon
Aug 25 '06 #12

"jmcgill" <jm*****@email.arizona.edu>
??????:3eFHg.3864$y61.3549@fed1read05...
Chen shuSheng wrote:
><sp****@gmail.com>
??????:11**********************@i42g2000cwa.googl egroups.com...
>>Chen shuSheng wrote:

<sp****@gmail.com>
??????:11**********************@b28g2000cwb.goo glegroups.com...
Chen ShuSheng wrote:
>>

It's time to learn about object code linkage.
I'd like to. Could you advise a good book for new comer?
Aug 26 '06 #13

"Chris Dollin" <ch**********@hp.com>
??????:ec**********@malatesta.hpl.hp.com...
Chen shuSheng wrote:
><sp****@gmail.com>
??????:11**********************@i42g2000cwa.googl egroups.com...
>>Chen shuSheng wrote:

<sp****@gmail.com>
??????:11**********************@b28g2000cwb.goo glegroups.com...
Chen ShuSheng wrote:

[The `kind soul` might have been the compiler vendor, as part of
delivering
the compiler; or it might be the operating system provider, who may have
made an implementation of the C standard library available by default;
or it /could/ be that the compiler recompiles standard library functions
on demand, in which case it can know what the function body is without
it being anywhere "publically available".]
I see a directory named "lib" under my IDE 's directory. It is described
as containing "start-up code" and "run-time code". I want to know if the
function body is transfered to "??.obj" file under that directory. I also
want to know which .obj file is the "start-up code" .
Aug 26 '06 #14
Chen shuSheng wrote:
"Chris Dollin" <ch**********@hp.com>
??????:ec**********@malatesta.hpl.hp.com...
>Chen shuSheng wrote:
>[The `kind soul` might have been the compiler vendor, as part of
delivering
the compiler; or it might be the operating system provider, who may have
made an implementation of the C standard library available by default;
or it /could/ be that the compiler recompiles standard library functions
on demand, in which case it can know what the function body is without
it being anywhere "publically available".]

I see a directory named "lib" under my IDE 's directory. It is described
as containing "start-up code" and "run-time code". I want to know if the
function body is transfered to "??.obj" file under that directory. I also
want to know which .obj file is the "start-up code" .
Then ask somewhere they know about your IDE, such as groups dedicated to
it or to your OS. We don't deal with the specifics of the thousands of
development systems here. However, unless you are writing code for an
embedded system and you are meant to modify the startup and/or library
code (I've had to, but on those systems the implementer provided and
documented the source because it was one of the situations where the
implementer *wanted* you to deal with some system specifics) there is no
need for you to worry about this. It would generally be as useful as
trying to get the circuit diagrams for your video recorder when you want
to use it to record programs.
--
Flash Gordon
Aug 26 '06 #15

"Flash Gordon" <sp**@flash-gordon.me.uk>
??????:oj************@news.flash-gordon.me.uk...
Chen shuSheng wrote:
>"Chris Dollin" <ch**********@hp.com>
??????:ec**********@malatesta.hpl.hp.com...
>>Chen shuSheng wrote:
>>[The `kind soul` might have been the compiler vendor, as part of
delivering
the compiler; or it might be the operating system provider, who may have
made an implementation of the C standard library available by default;
or it /could/ be that the compiler recompiles standard library functions
on demand, in which case it can know what the function body is without
it being anywhere "publically available".]

I see a directory named "lib" under my IDE 's directory. It is
described as containing "start-up code" and "run-time code". I want to
know if the function body is transfered to "??.obj" file under that
directory. I also want to know which .obj file is the "start-up code" .

Then ask somewhere they know about your IDE, such as groups dedicated to
it or to your OS. We don't deal with the specifics of the thousands of
development systems here. However, unless you are writing code for an
embedded system and you are meant to modify the startup and/or library
code (I've had to, but on those systems the implementer provided and
documented the source because it was one of the situations where the
implementer *wanted* you to deal with some system specifics) there is no
need for you to worry about this. It would generally be as useful as
trying to get the circuit diagrams for your video recorder when you want
to use it to record programs.
--
Flash Gordon
I understand. What I want to know is not the language itself and it's other
things. Thank you.
Aug 26 '06 #16
Chen shuSheng wrote:
"jmcgill" <jm*****@email.arizona.edu>
It's time to learn about object code linkage.

I'd like to. Could you advise a good book for new comer?
"Expert C programming" by Peter van der Linden
has a chapter on linking. But linking is very platfrom
specific so if you need to understand in every detail
how linking gets done on the platform you're using
then you need to find a book which deals specifically
with your platform.

Spiros Bousbouras

Aug 26 '06 #17
Chen shuSheng wrote:
"jmcgill" <jm*****@email.arizona.edu>
??????:3eFHg.3864$y61.3549@fed1read05...
>Chen shuSheng wrote:
>><sp****@gmail.com>
??????:11**********************@i42g2000cwa.goog legroups.com...
Chen shuSheng wrote:

<sp****@gmail.com>
??????:11**********************@b28g2000cwb.go oglegroups.com...
>Chen ShuSheng wrote:
>It's time to learn about object code linkage.

I'd like to. Could you advise a good book for new comer?

It depends on your platform. Are you using a variety of Unix, or are
you using something weird?
Aug 26 '06 #18

"jmcgill" <jm*****@email.arizona.edu>
??????:ORYHg.3917$y61.2549@fed1read05...
Chen shuSheng wrote:
>"jmcgill" <jm*****@email.arizona.edu>
??????:3eFHg.3864$y61.3549@fed1read05...
>>Chen shuSheng wrote:
><sp****@gmail.com>
>??????:11**********************@b28g2000cwb.g ooglegroups.com...
>>Chen ShuSheng wrote:
>>It's time to learn about object code linkage.

I'd like to. Could you advise a good book for new comer?


It depends on your platform. Are you using a variety of Unix, or are
you using something weird?
I am now working under Windows Xp. But i want to learn more about open
source. So is red hat linux a good choice or can you suggest one variable of
Unix?
Aug 27 '06 #19
"Chen Shusheng" <cs*****@gmail.comwrites:
"jmcgill" <jm*****@email.arizona.edu>
??????:ORYHg.3917$y61.2549@fed1read05...
>It depends on your platform. Are you using a variety of Unix, or are
you using something weird?

I am now working under Windows Xp. But i want to learn more about open
source. So is red hat linux a good choice or can you suggest one variable of
Unix?
<OT>
Redhat isn't free anymore, and the free versions aren't supported.
Their free Linux is now called "Fedora" and is community maintained.
It's my favorite Linux for programming.

If you for some reason want a GUI, go with Ubuntu. It has the best
default programming font I've ever seen.
</OT>

Further discussion should be taken elsewhere.

--
Andrew Poelstra <http://www.wpsoftware.net/projects>
To reach me by email, use `apoelstra' at the above domain.
"Do BOTH ends of the cable need to be plugged in?" -Anon.
Aug 27 '06 #20

Chen Shusheng wrote:

I am now working under Windows Xp. But i want to learn more about open
source. So is red hat linux a good choice or can you suggest one variable of
Unix?
There are many Linux variants to choose from. Red Hat is as good
as any other, and better than many. Getting a Fedora install disk
is easy, and installing it is relatively painless:

http://fedoraproject.org/wiki/Distribution/Download

Aug 27 '06 #21
Chen Shusheng wrote:
>It depends on your platform. Are you using a variety of Unix, or are
you using something weird?

I am now working under Windows Xp. But i want to learn more about open
source. So is red hat linux a good choice or can you suggest one variable of
Unix?
Red Hat will be fine. I recommend Ubuntu, since I generally prefer
Debian-based distributions and Ubuntu is one of the more complete and
easily installed Debian system.

But if you don't want to change your OS, you can still use GCC on
Windows, either under an environment called Cygwin or with a system like
DEV C++ (which also does C).

Aug 28 '06 #22

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Michel Rouzic | last post by:
I have a binary file used to store the values of variables in order to use them again. I easily know whether the file exists or not, but the problem is, in case the program has been earlier...
3
by: Chen ShuSheng | last post by:
HI, I am now study a segment of codes: ------------------------ printf("%p\t",fp); /*add by me*/ fseek(fp, 0L, SEEK_END); /* go to end of file */ printf("%p\t",fp); ...
9
by: hstagni | last post by:
I tried to use fseek in a file opened for writing: ------ BEGIN ------- int main() { char c; FILE *fp; fp=fopen("texto", "wb"); putc('a', fp); putc('b', fp);
84
by: aarklon | last post by:
Hi all, I found an interesting article here:- http://en.wikipedia.org/wiki/Criticism_of_the_C_programming_language well what do you guys think of this article....??? Is it constructive...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.