首页 > 编程语言 > 详细

C/C++及OO思想笔记

时间:2017-02-26 00:09:04      阅读:259      评论:0      收藏:0      [点我收藏+]

c标准库部分冷门函数。

stdio.h  char buf[256];

      sscanf(buf,"%s",&buf);

      sprintf(buf,"Name: %s","xxx");

math.h  ceil()向下取整,floor()向上取整

time.h  获取系统时间  

      struct tm * localtime(const time_t *tod);  //将“秒”纸转成“年月日时     

      time_t mktime(struct tm *tptr);       //将“年月日时分秒”转成

      time_t time(time_t * tod);          //取得当前时间

      struct tm

      {

        int tm_sec;

        int tm_min;

        int tm_hour;

        int tm_mday;

        int tm_mon;

        int tm_year;

        int tm_wday;

        int tm_ydat;

      }

      time_t now=time(0); //获取系统;

      /*计数毫秒级时间*/

      time_t start = time(NULL);

      for(i=0;i<10000;i++)

      {

         //...

      }

      time_t end =time(NULL);

      int avg =(end-start)/10000;

stdlib.h

      double atof(const char *s);

      int atoi(const char *s);

      int rand(void);

      void srand(unsigned int seed);

      int system(const char *s);

string.h

      memcpy(dst,scr,n);从src复制n个字节到dst,  memcmp(a,b,n);比较n个字节的内容。memmove(dst,src,n)移动数据。

文件操作;

      FILE *fopen(const char *filename,const char *mode);

      int fclose(FILE *stream);

      size_t fwrite(const void *buf ,size_t size,size_t  nelem,FILE * stream);

      size_t fread(const void *buf ,size_t size,size_t  nelem,FILE * stream);

      fprintf(); fgets();

      fseek(fp,n,str);     n跳到100个字节,SEEK_SET(跳到第n个位置)  SEEK_END(跳到第n个位置)

               SEEK_CUR(跳到当前前n个位置)  SEEK_CUR(跳到当前后n个位置)

 

      

C/C++及OO思想笔记

原文:http://www.cnblogs.com/Q1143316492/p/6443261.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!