linux系统库函数之memset

531 #ifndef __HAVE_ARCH_MEMSET
532 /**
533  * memset - Fill a region of memory with the given value
534  * @s: Pointer to the start of the area.
535  * @c: The byte to fill the area with
536  * @count: The size of the area.
537  *
538  * Do not use memset() to access IO space, use memset_io() instead.
539  */
540 void *memset(void *s, int c, size_t count)
541 {
542         char *xs = s;
543 
544         while (count--)
545                 *xs++ = c;
546         return s;
547 }
548 EXPORT_SYMBOL(memset);

549 #endif

memset函数用于将一段内存空间初始化成一个指定值,一般用于将内存空间初始化成零值。

posted @ 2012-03-20 13:51  移动应用开发  阅读(220)  评论(0编辑  收藏  举报