Subject: strncat bug example
From: [email-masked] (Axel Riese)

14 Nov 1997 00:53:59 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
To: [email-masked] (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: [email-masked]
Austria             URL: http://www.risc.uni-linz.ac.at/research/combinat/risc/
===============================================================================
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".