memset;wmemset(源自msdn)

来源:互联网 发布:数据朔源技术的目标 编辑:程序博客网 时间:2024/05/29 13:59

以下源自msdn:----------------------------------------------------------------------------------------------

void *memset(
   void *dest,
   int c,
   size_t count
);
wchar_t *wmemset(
   wchar_t *dest,
   wchar_t c,
   size_t count
);

参数:-------------------------------------------------------------------------------------------------------------

dest  :Pointer to destination.
c       :Character to set.
count:Number of characters.
说明:-------------------------------------------------------------------------------------------------------------
Sets the first count characters of dest to the character c. (置dest的前count个值为c)
依赖头文件:----------------------------------------------------------------------------------------------------
memset
 <memory.h> or <string.h>
wmemset
 <wchar.h>
例子:-------------------------------------------------------------------------------------------------------------
  #include <memory.h>  #include <stdio.h>
 
  int main( void )
  {
     char buffer[] = "This is a test of the memset function";
 
     printf( "Before: %s\n", buffer );
     memset( buffer, '*', 4 );
     printf( "After:  %s\n", buffer );
  }
输出:-------------------------------------------------------------------------------------------------------------
Before: This is a test of the memset function
After:  **** is a test of the memset function

0 0