Unix Programming - I can't compile late Stevens first couple od code from apue

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > I can't compile late Stevens first couple od code from apue





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author I can't compile late Stevens first couple od code from apue
vectrum

2004-01-23, 5:21 pm

Hello,
I,m unix newbie and currently learning c. My problem is
I can't compile first couple of codes from late Stevens book Advanced
programming in unix environment. whenever I try to compile the very first
code I get error.
It seems all the error functions (err_sys, err_quit etc) are not wroking.
My os is freebsd 5.0. Can you help me?
Perhaps its not the best place to post a newbie's message but I am really
helpless. If u need the more info, I'll send u all the steps I performed.
Regards,



Rich Teer

2004-01-23, 5:21 pm

On Tue, 6 Jan 2004, vectrum wrote:
quote:

> It seems all the error functions (err_sys, err_quit etc) are not wroking.
> My os is freebsd 5.0. Can you help me?



Did you compile the apue library first?
quote:

> Perhaps its not the best place to post a newbie's message but I am really



This is the right place to ask!

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
David Schwartz

2004-01-23, 5:21 pm


"Rich Teer" <rich.teer@rite-group.com> wrote in message
news:Pine.SOL.4.58.0401061024430.24644@zaphod.rite-group.com...
quote:

> On Tue, 6 Jan 2004, vectrum wrote:


quote:


[QUOTE][color=darkred]
[QUOTE][color=darkred]
> This is the right place to ask!




This is the right place to ask, but some of us aren't too savvy on the
technical lingo. So you should avoid overly-technical explanations like "the
functions are not working" and instead use simpler terms like "my linker
generates a 'symbol not found' error for following symbols" or "my compiler
generates the following error message".

DS




Morris Dovey

2004-01-23, 5:21 pm

David Schwartz wrote:
quote:

> "Rich Teer" <rich.teer@rite-group.com> wrote in message
> news:Pine.SOL.4.58.0401061024430.24644@zaphod.rite-group.com...
>
>
>
>
>
> This is the right place to ask, but some of us aren't too
> savvy on the technical lingo. So you should avoid
> overly-technical explanations like "the functions are not
> working" and instead use simpler terms like "my linker
> generates a 'symbol not found' error for following symbols" or
> "my compiler generates the following error message".



Vectrum...

Because you're a newbie; and because I think I just heard David's
flamethrower burp (ever so gently), I'd like to suggest that you
follow the link in my sig to an excellent document on asking
"smart" questions...

You may find some of the others helpful, as well.
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c
Read my lips: The apple doesn't fall far from the tree.

Mike Chirico

2004-01-23, 5:21 pm


"vectrum" <t@obelisk.com> wrote in message
news:btetvo$65isd$1@ID-187765.news.uni-berlin.de...
quote:

> Hello,
> I,m unix newbie and currently learning c. My problem is
> I can't compile first couple of codes from late Stevens book Advanced
> programming in unix environment. whenever I try to compile the very first
> code I get error.
> It seems all the error functions (err_sys, err_quit etc) are not wroking.
> My os is freebsd 5.0. Can you help me?
> Perhaps its not the best place to post a newbie's message but I am really
> helpless. If u need the more info, I'll send u all the steps I


performed.
quote:

> Regards,
>


Take a look Appendix B in his book. Steven's has a custom header
"ourhdr.h" which he defines err_sys, err_quit and others.

Howerver, here's another option:

Take a look at the first program that demonstrates read and write.
Use the man with "2" as follows:

man 2 read
man 2 write

This will tell you important specifics on the command and
necessary headers. You can substitute

fprintf(stderr, " your error message")

for some of his err_* files. This command it good
to know...because fprintf(stderr is unbuffered...it will print a
message immediately.

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#define BUFFSIZE 8192
int
main(void)
{
int n;
char buf[BUFFSIZE];

while ( (n= read(STDIN_FILENO, buf, BUFFSIZE)) > 0 )
if (write(STDOUT_FILENO, buf, n) != n)
fprintf(stderr,"write error\n");

if (n < 0 )
fprintf(stderr, "read error\n");

exit(0);
}

ok..the lazy way is to take a look at the website...I think they have
specifics for compiling on each platform; but, then you miss out on all the
interesting stuff.

Regards,

Mike Chirico


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com