delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/11/14/00:53:59

From: Axel DOT Riese AT risc DOT uni-linz DOT ac DOT at (Axel Riese)
Subject: strncat bug example
14 Nov 1997 00:53:59 -0800 :
Message-ID: <199711140827.AA28646.cygnus.gnu-win32@melmac.risc.uni-linz.ac.at>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com (GNU-Win32)

Hi all !

I was asked to give a code example where the COOLVIEW strncat function fails.
Consider the following (which is nonsense, but shows what's going on):

....
int main()
{
  char string[10];

  ...
  strcpy(string, "test");
  ...

  /* make string empty and check */
  string[0] = '\0';
  printf(string);

  /* append a character and check */ 
  strncat(string, "x", 1);
  printf(string);

  return 0;
}


This example should print

-> 
-> x

(without arrows...), but it actually gives

->
-> testx

BTW, after replacing the cygwin.dll from COOLVIEW by its original b18 version,
the result is correct.


Hope this helps,

Axel


===============================================================================
Axel Riese
Research Institute for Symbolic Computation
J. Kepler University Linz
A-4040 Linz                              e-Mail: Axel DOT Riese AT risc DOT uni-linz DOT ac DOT at
Austria             URL: http://www.risc.uni-linz.ac.at/research/combinat/risc/
===============================================================================
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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