Is it important to learn system calls before std c library ? - Unix

This is a discussion on Is it important to learn system calls before std c library ? - Unix ; Hello, Is it important to learn system call APIs first before learning the standard c library APIs of same routine in learning nix programming ? As for an example; do i need to learn to use sys call "read" before ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Is it important to learn system calls before std c library ?

  1. Is it important to learn system calls before std c library ?

    Hello,

    Is it important to learn system call APIs first before learning the
    standard c library APIs of same routine in learning nix programming ?
    As for an example; do i need to learn to use sys call "read" before
    using std c api "fread" etc. as far as learning unix programming is
    concerned.
    Another way: Which one of the following should read first ?
    Adv. programming in unix environment ...Rick Stevens.
    Adv. unix programming ......Marc Rochkind

    Regards,






  2. Re: Is it important to learn system calls before std c library ?

    nix writes:
    >Is it important to learn system call APIs first before learning the
    >standard c library APIs of same routine in learning nix programming ?
    >As for an example; do i need to learn to use sys call "read" before
    >using std c api "fread" etc. as far as learning unix programming is
    >concerned.
    >Another way: Which one of the following should read first ?
    >Adv. programming in unix environment ...Rick Stevens.
    >Adv. unix programming ......Marc Rochkind



    It doesn't matter what order, they aren't all that different anyway.
    I wouldn't go around thinking that read() is the direct system call,
    while fread() is built ontop of it, just that they do the same sort of
    thing, but used slightly different. They get used about equally by
    programmers for various things.

    Either book would be fine to read first. I like the Stevens book better.










  3. Re: Is it important to learn system calls before std c library ?

    On Aug 21, 3:42 am, nix wrote:
    > Hello,
    >
    > Is it important to learn system call APIs first before learning the
    > standard c library APIs of same routine in learning nix programming ?
    > As for an example; do i need to learn to use sys call "read" before
    > using std c api "fread" etc. as far as learning unix programming is
    > concerned.
    > Another way: Which one of the following should read first ?
    > Adv. programming in unix environment ...Rick Stevens.
    > Adv. unix programming ......Marc Rochkind
    >
    > Regards,


    'read' and 'fread', both as used in C, are quite different in that
    'read' essentially reads directly from the descriptor via the kernel
    whereas 'fread' involves an internal data buffer. You generally can't
    successfully combine both 'read' and 'fread' on the same file
    descriptor, which most documentation generally won't tell you.

    It helps to understand that all C API functions are build off of
    system calls and although the system call bypasses the additional
    layer provided by the C library, that additional layer often adds
    convenience and portability. You can generally take any given C
    function, such as 'fread', and take a look at the similar system calls
    and get a good idea of what the C library does internally to make up
    the additional functionality. It always helps to know a little bit
    about the internal functionality of a C function because it makes
    learning new functions easier and gives you some idea of what's
    happening when something goes wrong.
    Kevin P. Barry

+ Reply to Thread