Message-ID: <366EC5A6.E2EDB2A9@videotron.ca> From: Stephane Hockenhull Organization: Potam Soft X-Mailer: Mozilla 4.04 [en] (Win95; I) MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: memcpy() vs memmove() References: <74ll3i$h7k$1 AT hermes DOT is DOT co DOT za> <74lqta$l3o$1 AT antares DOT lu DOT erisoft DOT se> <74lrv4$k9i$1 AT hermes DOT is DOT co DOT za> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 29 Date: Wed, 09 Dec 1998 13:47:02 -0500 NNTP-Posting-Host: 207.96.133.152 X-Complaints-To: abuse AT videotron DOT net X-Trace: weber.videotron.net 913229242 207.96.133.152 (Wed, 09 Dec 1998 13:47:22 EDT) NNTP-Posting-Date: Wed, 09 Dec 1998 13:47:22 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Freddie Schwenke wrote: > > I'm quite aware that there is a differrence between the two functions. I > actually want to abuse the memcpy() function to replicate one ore more bytes > throughout a string. The problem is that memcpy() only works while the > length is less that 16. WHY??? > > Is this a C thing or a DJGPP thing? In MS Visual C++ apparently there is no > difference betwee the two functions!!! > try: for (int i=0; i < 9; i++){ buffer[i+1] = buffer[i]; } you'll be sure it work the same in any compiler. the reason why memcpy() might not work as expected (the one i think why, i didnt look at the memcpy() source tho) is because over 15 chars it could use 32bit memory copy (for speed reasons) while memmove() would always use byte per byte copy (slower) -- Stephane Hockenhull Rv[PotamSoft] mailto:potam AT videotron DOT ca http://pages.infinit.net/potam/