|
From: Ioannis V. <no...@ya...> - 2001-10-23 08:45:44
|
Uf. I do not want to open issues here, but there are many searching algorithms (which i do not know). One efficient the C library provides is bsearch(). Of course this particulal algorithm isn't applicable here, but the point is that any implementation can provide its own strcat() version. It can be written in assembly, pascal (as in C++ Builder) with a C type interface, e.t.c.. It is only guaranteed that it doesn't miss the first appearance of '\0'. Of course it can be written in C looking character after character. :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys > -----Original Message----- > From: Juliet [mailto:no...@li...]=20 > Sent: Monday, October 22, 2001 8:28 PM > To: Ioannis Vranos > Subject: RE: [Dev-C++] Errorhandling >=20 >=20 > At 00.54 21/10/2001 +0200, you wrote: > >That doesn't mean that strcat() searches character by=20 > character for 0=20 > >but > >it *behaves* as if it does that. >=20 > Post-scriptum to my previous message: well, it DOES. It's the=20 > only way to=20 > do it, you just have to write it in the most efficient way.=20 > Look at this=20 > (strcat.c, from ReactOS msvcrt implementation): >=20 > /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details=20 > */ #include <msvcrt/string.h> >=20 > char * > strcat(char *s, const char *append) > { > char *save =3D s; >=20 > for (; *s; ++s); > while ((*s++ =3D *append++)); > return save; > } >=20 |