[prog] Solution

Elizabeth Barham lizzy at soggytrousers.net
Fri Jan 31 14:04:05 EST 2003


"Sachin" writes:

Hi Sachin,

   The most glaring error of your code is the odd use of defining
certain header file symbols (such as _STDIO_H for <stdio.h>) prior to
including the header file itself.

from COMM.H:

        /* FOR PRINTF AND SCANF FUNCTIONS */
        #ifndef  STDIO_H
                #define _STDIO_H
                #include<stdio.h>
        #endif

This has the effect of *not* including <stdio.h>. To see why, look
at the beginning of /usr/include/stdio.h:

/*
 *	ISO C99 Standard: 7.19 Input/output	<stdio.h>
 */

#ifndef _STDIO_H

since you define _STDIO_H in your own header file, the contents
are *not* included in COMM.H. Rather, you should just do a simple:

#include <stdio.h>

which deals with the whole issue of not having header files included
twice.

   Anyway, I modified your program and, to the best of my understading
of how it should function, it works fine. You will find a copy of it
at:

        http://www.soggytrousers.net/repository/socket-update.zip

Regards, Elizabeth






More information about the Programming mailing list