regarding unix specific commands

Discussion in 'C Programming' started by fidlee, Jan 1, 2006.

  1. fidlee

    fidlee Guest

    I dont know if this is the right place to ask this question.

    i got this book "The C Odyssey. Unix - The Open, Boundless C"
    It is a 1992 edition book

    The book speaks of all the unix specific functions

    Just quoting an example below:

    void main()
    {

    int pid;
    pid=getpid();
    printf("Process id is \n",pid);

    }

    I would like to know if this should run on any linux flavour(since this
    book talks only on unix/) with gcc compiler installed on it.What I
    would like to know is if this book would prove useful to me if i would
    like to play around with Linux.

    Thanks in advance
     
    fidlee, Jan 1, 2006
    #1
    1. Advertising

  2. fidlee said:

    > I dont know if this is the right place to ask this question.
    >
    > i got this book "The C Odyssey. Unix - The Open, Boundless C"
    > It is a 1992 edition book
    >
    > The book speaks of all the unix specific functions
    >
    > Just quoting an example below:
    >
    > void main()


    That's a bad sign. In C, main returns int, not void. There were a couple of
    other problems with the code, too.

    My own personal recommendations for Linux programming are "The Unix
    Programming Environment" (Kernighan and Pike), "Linux Programming by
    Example" by Kurt Wall, and "Advanced Programming in the Unix Environment"
    (W Richard Stevens).

    Probably in that order. And of course any other book by WRS, too.

    But this newsgroup is about C, not about Unix or Linux, so I suggest you
    seek further inspiration in comp.unix.programmer or
    comp.os.linux.development.apps or something of that ilk, where you will get
    much better answers to your Linux questions than you could possibly hope
    for in this group.


    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at above domain (but drop the www, obviously)
     
    Richard Heathfield, Jan 1, 2006
    #2
    1. Advertising

  3. fidlee wrote:
    > I dont know if this is the right place to ask this question.
    >
    > i got this book "The C Odyssey. Unix - The Open, Boundless C"
    > It is a 1992 edition book
    >
    > The book speaks of all the unix specific functions
    >
    > Just quoting an example below:
    >
    > void main()

    ^^^^
    You're dead already.
    If this book really has main with a void return type, burn the book.
    Quickly.
     
    Martin Ambuhl, Jan 1, 2006
    #3
  4. Martin Ambuhl said:

    > fidlee wrote:
    >>
    >> void main()

    > ^^^^
    > You're dead already.
    > If this book really has main with a void return type, burn the book.
    > Quickly.


    Unless it's an intentional example of How Not To Write C. I am uncomfortably
    aware that it is possible for advice along the lines of "DON'T DO THIS!" to
    be read by some people as if it comprised not three words, but two. (I am
    thinking particularly of the fflush(stdin) example in "C Unleashed".)

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at above domain (but drop the www, obviously)
     
    Richard Heathfield, Jan 1, 2006
    #4
  5. fidlee

    Chuck F. Guest

    Martin Ambuhl wrote:
    > fidlee wrote:
    >
    >> I dont know if this is the right place to ask this question.
    >>
    >> i got this book "The C Odyssey. Unix - The Open, Boundless C"
    >> It is a 1992 edition book
    >>
    >> The book speaks of all the unix specific functions
    >>
    >> Just quoting an example below:
    >>
    >> void main()

    > ^^^^
    > You're dead already.
    > If this book really has main with a void return type, burn the
    > book. Quickly.


    I wonder if that could be an example of BullSchildt?

    --
    "If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers." - Keith Thompson
    More details at: <http://cfaj.freeshell.org/google/>
     
    Chuck F., Jan 1, 2006
    #5
  6. "fidlee" <> writes:
    > i got this book "The C Odyssey. Unix - The Open, Boundless C"
    > [...]
    > Just quoting an example below:
    >
    > void main()


    Burn it.

    DES
    --
    Dag-Erling Smørgrav -
     
    =?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=, Jan 1, 2006
    #6
  7. fidlee

    eerok Guest

    On 31 Dec 2005 21:51:38 -0800, fidlee wrote:

    [getpid()]

    > I would like to know if this should run on any linux flavour(since this
    > book talks only on unix/) with gcc compiler installed on it.What I
    > would like to know is if this book would prove useful to me if i would
    > like to play around with Linux.


    Do "man getpid" and you'll see that it conforms to posix, so
    it should be widely available on linux systems. You can do
    the same kind of check for any of the other functions you want
    to use from that book. Reading the man page for functions
    you're curious about is common sense on unix in any case.

    This isn't topical here, but it's offered in the spirit of
    "teach a man to fish ..."

    --
    "The secret of being boring is to say everything." - Voltaire
     
    eerok, Jan 1, 2006
    #7
  8. fidlee

    Malcolm Guest

    "Richard Heathfield" <> wrote
    > Unless it's an intentional example of How Not To Write C. I am
    > uncomfortably
    > aware that it is possible for advice along the lines of "DON'T DO THIS!"
    > to
    > be read by some people as if it comprised not three words, but two. (I am
    > thinking particularly of the fflush(stdin) example in "C Unleashed".)
    >

    In English academic writing we use a star to represent illegal forms

    e.g.

    *English as she is spoke.

    You need some silimar convention for C examples.
     
    Malcolm, Jan 1, 2006
    #8
  9. fidlee

    Pradyut Guest

    --
    Pradyut
    http://pradyut.tk
    http://groups.yahoo.com/group/d_dom/
    http://groups-beta.google.com/group/oop_programming
    India
    "fidlee" <> wrote in message
    news:...
    >I dont know if this is the right place to ask this question.
    >
    > i got this book "The C Odyssey. Unix - The Open, Boundless C"
    > It is a 1992 edition book
    >
    > The book speaks of all the unix specific functions
    >
    > Just quoting an example below:
    >
    > void main()
    > {
    >
    > int pid;
    > pid=getpid();
    > printf("Process id is \n",pid);
    >
    > }

    You missed %d in the line
    printf("Process id is %d\n",pid);

    And int main not void, with a return before ending the program

    Whatever, if the book talks about gcc, gcc package remains the same,
    whatever flavour u may be using for unix(or linux).
    Ofcourse the path for the libraries and hardware interrupts may change

    >
    > I would like to know if this should run on any linux flavour(since this
    > book talks only on unix/) with gcc compiler installed on it.What I
    > would like to know is if this book would prove useful to me if i would
    > like to play around with Linux.
    >
    > Thanks in advance
    >
     
    Pradyut, Jan 2, 2006
    #9
  10. fidlee

    Chuck F. Guest

    Pradyut wrote:

    Absolutely nothing, except a 66 line signature, which is
    automatically discarded on reply by the better newsreaders.

    In other words, a sig-line belongs at the end, after your comments,
    which in turn may be either interspersed or after the *clipped*
    material you quote.

    Some newsreaders have (mistakenly) allowed a sig to be injected at
    the head of quoted material. This option should *never* be used.

    --
    "If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers." - Keith Thompson
    More details at: <http://cfaj.freeshell.org/google/>
     
    Chuck F., Jan 3, 2006
    #10
    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. Yadagiri Rao KP

    Run unix commands from Java

    Yadagiri Rao KP, Aug 5, 2003, in forum: Java
    Replies:
    2
    Views:
    7,862
    Dave Miller
    Aug 5, 2003
  2. Yadagiri Rao KP

    Get all commands from unix

    Yadagiri Rao KP, Aug 7, 2003, in forum: Java
    Replies:
    4
    Views:
    449
    William Dowling
    Aug 7, 2003
  3. Spendius
    Replies:
    2
    Views:
    3,075
    Rogan Dawes
    Dec 13, 2004
  4. Ben Pfaff

    Re: man pages for C commands (GCC commands)

    Ben Pfaff, Jun 24, 2003, in forum: C Programming
    Replies:
    4
    Views:
    4,008
    Thomas Stegen
    Jun 28, 2003
  5. Tim Stanka
    Replies:
    1
    Views:
    835
    Jeff Epler
    Aug 2, 2004
Loading...

Share This Page