On Thu, 2 Jan 2003, Charles Lockhart wrote:
>Anybody know what the fastest way to clear a buffer in C on Linux would
>be?  Anything faster than
>
>for(i = 0; i < sizeofbuffer; i++)
>       buffer[i] = 0;

How about using pointers so you don't need to use an index?

>For some reason I think I saw
>memcpy(&buffer, 0, sizeofbuffer);
>used somewhere once, but after a long day, that looks wierd to me.

If by weird, you mean it will crash.  Yeah, this is weird.  ;-)

I think you meant memset.  memcpy takes two buffers.

--jc
-- 
Jimen Ching (WH6BRR)      [EMAIL PROTECTED]     [EMAIL PROTECTED]

Reply via email to