[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mud problems



On: Fri, 14 Aug 1998 16:41:23 -0400 David L Kocher writes:
> 
> Hi, I'm coding for a mud and I've run into some problems porting it to
> Debian...
> 
> The write functions seems to be different... my previous declaration
> gave it's vars as
> 
> (( int fd, char *buf, int nbyte ))
> 
> The Debian declaration gives them as
> 
> (( int fd, const char *bug, int nbyte ))
> 
> When I change my char to constant chars it really hurts
> things... any suggestions?

You don't need to change anything.  A char * can be (implicitly)
converted to a const char *, see this code as example:

  #include <stdio.h>

  int print(const char *buf)
  {
    return printf("%s\n", buf);
  }

  int main()
  {
    char *array = "Test";

    print(array);
    return 0;
  }

which compiles without any warning even with -Wall enabled.

	Torsten

BTW: You should better ask a C-related newsgroup (e.g., comp.lang.c)
or a unix programming related (such as comp.unix.programmer) for such
problems.


Reply to: