if(strstr(dbidxml->txt,ezxml_attr(xmlchild,"INDEX")))
什么意思?

解决方案 »

  1.   

    strstr()查找子字符串出现的位置
      

  2.   

    strstr返回找到的字符串第一次出现的地址,没找到返回NULL
      

  3.   

    Return a pointer to the first occurrence of a search string in a string
      

  4.   

    MSDN上有解释啊
    Returns a pointer to the first occurrence of strSearch in str, or NULL if strSearch does not appear in str. If strSearch points to a string of zero length, the function returns str. 
      

  5.   

    if(strstr(dbidxml->txt,ezxml_attr(xmlchild,"INDEX")))strstr会在dbidxml->txt这个字串了面寻找ezxml_attr(xmlchild,"INDEX"),如果寻找到的话,会返回一个地址,地址(0x0000xxxx)是一个存在的数据,所以这时就是等同于if(TRUE)。反之,如果没有找到,返回的将是NULL,NULL是一个等同于0的存在,所以这时这句话就解析成了if(FAUSE)。
      

  6.   

    还是直接和NULL比较比较妥当吧,避免这种使用