C语言学习

1.查找字符串用的函数

# include《string》     
          char *strstr(const char *haystack, const char *needle)

作用:查找一组字符串中的某个单词
例——》在 字符串 table[]={my name is startport} 查找 “name”
用法
( 首先明确一点,返回值问题。
若找到单词,返回当前第一个字母的地址。没有则返回NULL)

       if(strstr(table, "name") )     //查找有没有这个单词
       {  
              找到;
        }
        
        whlie(!strstr(table, "name") ); 这个是等待接收到数据,再运行

2,memset(g_ucPswBuffer,0xff,PW_EEPROM_LENTH);

  **作用**:用来写入数组值,一般用来 初始化数组
         例——》在  初始化数据 table[10]={} 为oxff

用法

      memset(table,0xff,10);//目标数据地址,要初始化值,数组个数
posted @ 2018-10-29 21:08  星空小蜗牛  阅读(107)  评论(0编辑  收藏  举报