zoukankan      html  css  js  c++  java
  • bzero memset setmem

    bzero

    置字节字符串s的前n个字节为零。

     #include <syslib.h>
           #include <string.h>
           int main()
           {
                    struct
                    {
                          int a;
                          char s[5];
                          float f;
                    } tt;
                    char s[20];
                    bzero(&tt,sizeof(tt));   // struct initialization to zero       bzero(s,20);
                    clrscr();
                    printf("Initail Success");
                    getchar();
                    return 0;
            }

     extern void *memset(void *buffer, int c, int count);
    用法:#include <string.h>

        
    功能:把buffer所指内存区域的前count个字节设置成字符c。 

     

     #include <syslib.h>
           #include <string.h>
           int main()
           {
               char *s="Golden Global View";
                clrscr();
               memset(s,'G',6);
               printf("%s",s);
               getchar();
                return 0;
            }

     

    setmem  
    原型:

    extern void setmem(void *buf, unsigned int count, char ch);          
    用法:#include <string.h>    


    功能:把buf所指内存区域前count个字节设置成字符ch。    
    说明:返回指向buf的指针。    
    举例:       // setmem.c
           #include <syslib.h>
           #include <string.h>
           int main()
           {
                char *s="Golden Global View";
               clrscr();
               setmem(s,6,'G');
              printf("%s",s);
                getchar();
              return 0;
            }

  • 相关阅读:
    Redis源码剖析之字典(dict)
    Redis源码剖析之跳表(skiplist)
    面试题精选:神奇的斐波那契数列
    awk实现类sql的join操作
    [翻译]CAP理论及其证明
    今年是冷冬?我爬了北京10年的气温,哟 还真是!
    python 等间隔抽取一定数量的数据
    操作系统-第十章-文件系统
    操作系统-第九章-虚拟内存管理
    操作系统-第八章-内存管理
  • 原文地址:https://www.cnblogs.com/greencolor/p/2743707.html
Copyright © 2011-2022 走看看