Borland C++ bug?

house ron s64421 at zeus.usq.EDU.AU
Thu Jun 20 22:04:47 AEST 1991


del at percheron.ecn.purdue.edu (David A Whittemore) writes:

>under borland C++ 2.0, however, the line:
>        sprintf(line, "%s %s", line, word);

>acts like:
>        strcpy(line, word) !

>which means it wipes out the existing contents of "line".

>is this a borland bug, or have i been making some bad
>assumptions as to how sprintf() works for years?

To quote the ANSI C standard, "If copying takes place between objects
that overlap, the behaviour is undefined."

--
Regards,

Ron House.   (s64421 at zeus.usq.edu.au)
(By post: Info Tech, U.C.S.Q. Toowoomba. Australia. 4350)



More information about the Comp.lang.c mailing list