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

Discussion in 'C Programming' started by Chen ShuSheng, Aug 25, 2006.

  1. 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.
    Chen ShuSheng, Aug 25, 2006
    #1
    1. Advertising

  2. Chen ShuSheng

    Guest

    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, 2006
    #2
    1. Advertising

  3. Chen ShuSheng

    Chris Dollin Guest

    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.
    Chris Dollin, Aug 25, 2006
    #3
  4. <>
    ??????:...
    > 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.
    Chen shuSheng, Aug 25, 2006
    #4
  5. Chen ShuSheng

    Guest

    Chen shuSheng wrote:

    > <>
    > ??????:...
    > > 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, 2006
    #5
  6. <>
    ??????:...
    > Chen shuSheng wrote:
    >
    >> <>
    >> ??????:...
    >> > 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.
    Chen shuSheng, Aug 25, 2006
    #6
  7. Chen ShuSheng

    CBFalconer Guest

    CBFalconer, Aug 25, 2006
    #7
  8. Chen ShuSheng

    Chris Dollin Guest

    Chen shuSheng wrote:

    > <>
    > ??????:...
    >> Chen shuSheng wrote:
    >>
    >>> <>
    >>> ??????:...
    >>> > 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
    Chris Dollin, Aug 25, 2006
    #8
  9. "Chen ShuSheng" <> writes:

    > 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.
    Andrew Poelstra, Aug 25, 2006
    #9
  10. Chen ShuSheng

    Simon Biber Guest

    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.
    Simon Biber, Aug 25, 2006
    #10
  11. Chen ShuSheng

    jmcgill Guest

    Chen shuSheng wrote:
    > <>
    > ??????:...
    >> Chen shuSheng wrote:
    >>
    >>> <>
    >>> ??????:...
    >>>> 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.
    jmcgill, Aug 25, 2006
    #11
  12. Chen ShuSheng

    Flash Gordon Guest

    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
    Flash Gordon, Aug 25, 2006
    #12
  13. "jmcgill" <>
    ??????:3eFHg.3864$y61.3549@fed1read05...
    > Chen shuSheng wrote:
    >> <>
    >> ??????:...
    >>> Chen shuSheng wrote:
    >>>
    >>>> <>
    >>>> ??????:...
    >>>>> 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?
    Chen shuSheng, Aug 26, 2006
    #13
  14. "Chris Dollin" <>
    ??????:ecn136$an6$...
    > Chen shuSheng wrote:
    >
    >> <>
    >> ??????:...
    >>> Chen shuSheng wrote:
    >>>
    >>>> <>
    >>>> ??????:...
    >>>> > 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" .
    Chen shuSheng, Aug 26, 2006
    #14
  15. Chen ShuSheng

    Flash Gordon Guest

    Chen shuSheng wrote:
    > "Chris Dollin" <>
    > ??????:ecn136$an6$...
    >> 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
    Flash Gordon, Aug 26, 2006
    #15
  16. "Flash Gordon" <>
    ??????:eek:-gordon.me.uk...
    > Chen shuSheng wrote:
    >> "Chris Dollin" <>
    >> ??????:ecn136$an6$...
    >>> 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.
    Chen Shusheng, Aug 26, 2006
    #16
  17. Chen ShuSheng

    Guest

    Chen shuSheng wrote:

    > "jmcgill" <>
    > > 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, 2006
    #17
  18. Chen ShuSheng

    jmcgill Guest

    Chen shuSheng wrote:
    > "jmcgill" <>
    > ??????:3eFHg.3864$y61.3549@fed1read05...
    >> Chen shuSheng wrote:
    >>> <>
    >>> ??????:...
    >>>> Chen shuSheng wrote:
    >>>>
    >>>>> <>
    >>>>> ??????:...
    >>>>>> 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?
    jmcgill, Aug 26, 2006
    #18
  19. "jmcgill" <>
    ??????:ORYHg.3917$y61.2549@fed1read05...
    > Chen shuSheng wrote:
    >> "jmcgill" <>
    >> ??????:3eFHg.3864$y61.3549@fed1read05...
    >>> Chen shuSheng wrote:
    >>>>>> <>
    >>>>>> ??????:...
    >>>>>>> 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?
    Chen Shusheng, Aug 27, 2006
    #19
  20. Re: Where could I find function bodies... OT: Linux distros

    "Chen Shusheng" <> writes:

    > "jmcgill" <>
    > ??????: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.
    Andrew Poelstra, Aug 27, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leslaw Bieniasz

    How to speed up ftell()/fseek()

    Leslaw Bieniasz, Jun 6, 2005, in forum: C++
    Replies:
    7
    Views:
    4,774
    Lionel B
    Jun 8, 2005
  2. xcm

    a question about ftell function

    xcm, May 30, 2005, in forum: C Programming
    Replies:
    4
    Views:
    325
    Scott J. McCaughrin
    Sep 23, 2005
  3. How do I (fseek, ftell, stat)?

    , Feb 14, 2006, in forum: C Programming
    Replies:
    2
    Views:
    459
  4. Kenneth Brody

    Text mode fseek/ftell

    Kenneth Brody, Mar 31, 2006, in forum: C Programming
    Replies:
    10
    Views:
    1,090
    Ben Bacarisse
    Apr 2, 2006
  5. Chen ShuSheng
    Replies:
    3
    Views:
    511
    Ancient_Hacker
    Aug 24, 2006
Loading...

Share This Page