regarding unix specific commands

F

fidlee

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
 
R

Richard Heathfield

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.
 
M

Martin Ambuhl

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()
^^^^
You're dead already.
If this book really has main with a void return type, burn the book.
Quickly.
 
R

Richard Heathfield

Martin Ambuhl said:
^^^^
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".)
 
C

Chuck F.

Martin said:
^^^^
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/>
 
?

=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=

fidlee said:
i got this book "The C Odyssey. Unix - The Open, Boundless C"
[...]
Just quoting an example below:

void main()

Burn it.

DES
 
E

eerok

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 ..."
 
M

Malcolm

Richard Heathfield said:
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.
 
P

Pradyut

--
Pradyut
http://pradyut.tk
http://groups.yahoo.com/group/d_dom/
http://groups-beta.google.com/group/oop_programming
India
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()
{

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
 
C

Chuck F.

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/>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top