strncat bug example

Axel Riese Axel.Riese@risc.uni-linz.ac.at
Fri Nov 14 00:28:00 GMT 1997


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.Riese@risc.uni-linz.ac.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@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list