Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 May 2000 00:47:17 +0200
From:      Willem Brown <willem@brwn.org>
To:        Gustavo Vieira Goncalves Coelho Rios <kernel@tdnet.com.br>
Cc:        questions@freebsd.org
Subject:   Re: strange error
Message-ID:  <3925C475.E0D8CDC4@brwn.org>
References:  <3925C207.789AC2AA@tdnet.com.br>

next in thread | previous in thread | raw e-mail | index | archive | help
Gustavo Vieira Goncalves Coelho Rios wrote:
Hi,

	It core dumps if that is what you mean. Changing 

printf("%s\n", *dir);

- to -

printf("%s\n", dir);

seems to fix the problem.

Regards
Willem Brown

> 
> What is the problem with this code. I simply can't figure out:
> 
> #include <stdio.h>
> #include <string.h>
> 
> char *a(char *);
> void t(char *);
> 
> /* You should call it with at least one parameters, ex:
>         ./a.out test <enter>
> */
> 
> void
> main(int argc, char *argv[])
> {
>         char *dir;
> 
>         ++argv;
>         printf("%s\n", *argv);
> 
>         dir = a(*argv);
>         t(dir);
> 
>         printf("%s\n", *dir);

=========================^
	  printf("%s\n", dir);

> }
> 
> void
> t(char *a)
> {
>         while (*a)
>                 *a++ = '1';
> }
> 
> char *
> a(char *b)
> {
>         return strdup(b);
> }
> 
> --
> Your mouse has moved.
> Windows NT must be restarted for the change to take effect!
> 
> Reboot now?   [ OK]
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
|--------------LINUX & *BSD, the CHOICE is yours--------------|


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3925C475.E0D8CDC4>