Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!overload!dillon From: dillon@overload.Berkeley.CA.US (Matthew Dillon) Newsgroups: comp.sys.amiga.programmer Subject: Re: What is setmem in Aztec's c.lib for? Message-ID: Date: 16 Feb 91 20:01:13 GMT References: <2662@opal.cs.tu-berlin.de> Organization: Not an Organization Lines: 38 In article <2662@opal.cs.tu-berlin.de> alcaman@opal.cs.tu-berlin.de (Alexander Weidt) writes: >Hi.. > I desperatley need some documentation on the setmem function found in >Aztec's c.lib. The function is documented NOWHERE, and i am at a loss of > >Alexander Weidt | UUCP: alcaman@tubopal.UUCP (alcaman@opal.cs.tu-berlin.de) setmem is pretty simple, it sets an area of memory to a character. You pass it a pointer to the base of the area to be jam set, the number of bytes, and the value to set each location to (0-255). setmem() normally returns its first argument but different compilers might implement the return value differently. void *setmem(void *, size_t, int); As to how it works, in C it does this (but most compilers actually write the thing in assembly so it goes fast): void * setmem(base, bytes, c) void *base; long bytes; int c; { char *ptr = base; while (bytes--) *ptr++ = (char)c; return(base); } -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA