This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Cygwin (december 2003 version) and strcat
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 20 Apr 2004 10:24:23 +0200
- Subject: Re: Cygwin (december 2003 version) and strcat
- References: <loom.20040420T014549-346@post.gmane.org>
- Reply-to: cygwin at cygwin dot com
On Apr 19 23:49, Martin Johansen wrote:
> Hi.
>
> I am experiencing problems using strcat and strncat.
>
> For some reason, these functions do not appent a zero.
$ cat > str.c << EOF
? #include <stdio.h>
? #include <string.h>
?
? int
? main ()
? {
? char c1[100], c2[100];
?
? memset (c1, 0xff, 100);
? memset (c2, 0x77, 100);
?
? c1[0] = '\0';
? c2[0] = '\0';
?
? strcat (c1, "1234567890");
? strncat (c2, "1234567890", 5);
?
? printf ("c1: <%s>\n", c1);
? printf ("c2: <%s>\n", c2);
?
? return 0;
? }
? EOF
$ make str
gcc str.c -o str
$ ./str
c1: <1234567890>
c2: <12345>
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Co-Project Leader mailto:cygwin@cygwin.com
Red Hat, Inc.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/