[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: Problem in calling err_sys procedure,



if you feel too lazy to implement arvind devarajan's solution, replace
"err_sys" by "perror".
#define err_sys perror


shourya


#-----Original Message-----
#From: Syed Khaleelulla [mailto:Syed.Khaleelulla@xxxxxxxxx]
#Sent: Wednesday, October 25, 2000 11:46 AM
#To: linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx
#Subject: Re: [LIP] Problem in calling err_sys procedure, 
#
#
#Hello,
#
#I think the "err_sys" is a private procedure that has been written.
#
#You can use the perror or strerror function, insted of that procedure.
#See man perror & man strerror for more detail.
#
#-Bye,
#Syed Khaleelulla.
#------------------
#
#On Wed, 25 Oct 2000, Ashish wrote:
#
#+
#+Hi,
#+
#+I have just started to learn network programming.
#+I tried to run a c program from Stevens book on network 
#+programming. 
#+
#+The program is
#+
#+#include<stdio.h>
#+#include<varargs.h>
#+#include<sys/types.h>
#+#include<sys/stat.h>
#+
#+main()
#+
#+{
#+ int pipefd[2], n ;
#+ char buff[100] ;
#+
#+ if( pipe(pipefd) < 0)
#+   err_sys("pipe erroe");
#+ 
#+ printf("read fd = %d, write fd = %d\n", pipefd[0], pipefd[1]);
#+ 
#+ if(write(pipefd[1], "hello world",12) != 12)
#+   err_sys("write error");
#+ 
#+ if( (n = read(pipefd[0], buff ,sizeof(buff))) <= 0 )
#+   err_sys("read error");
#+
#+ write(1, buff, n);
#+
#+ exit(0);
#+
#+}
#+
#+
#+Its giving error as follows:
#+
#+/tmp/cc6q5fia.o: In function `main':
#+/tmp/cc6q5fia.o(.text+0x1e): undefined reference to `err_sys'
#+/tmp/cc6q5fia.o(.text+0x5a): undefined reference to `err_sys'
#+/tmp/cc6q5fia.o(.text+0x84): undefined reference to `err_sys'
#+collect2: ld returned 1 exit status
#+
#+I am compiling on linux. Is there any header file I am not including?
#+Please let me know what's the problem
#+
#+bye
#+Ashish
#+
#
#
#---------------------------------------------
#Find out more about this and other Linux India
#mailing lists at http://lists.linux-india.org/
#