delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/04/20/04:25:26

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 20 Apr 2004 10:24:23 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin (december 2003 version) and strcat
Message-ID: <20040420082423.GA26840@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <loom DOT 20040420T014549-346 AT post DOT gmane DOT org>
Mime-Version: 1.0
In-Reply-To: <loom.20040420T014549-346@post.gmane.org>
User-Agent: Mutt/1.4.2i

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 AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019