求高手帮我看看这段在接收到的字符串中查找指定的字符的程序哪有毛病,我运行了貌似没有效果

[复制链接]
查看11 | 回复2 | 2011-8-19 07:20:40 | 显示全部楼层 |阅读模式
char*LookFor_string(uchar*s,uchar*t)//在s中找t,*s指向Rxbuf[]{uchar*s_temp;uchar*t_temp;uchar*m_temp;if(s==0||t==0)return(0);//如果没有字符,返回零for(s_temp=s;*s_temp!=\'\\0\';s_temp)//将s里面的字符串于t挨个进行比较{*m_temp=*s_temp;for(t_temp=t;*t_temp==*m_temp;m_temp,t_temp);if(*t_temp==\'\\0\')return(s_temp);}return(0);}
回复

使用道具 举报

千问 | 2011-8-19 07:20:40 | 显示全部楼层
这段代码怎么写得这么麻烦char*LookFor_string(uchar*s,uchar*t){uchar*temp=s;intnLen=strlen(temp);if(nLen==0||t==0)returnNULL;while(nLen--){if(*temp==*t){returntemp;}elsetemp;}}
回复

使用道具 举报

千问 | 2011-8-19 07:20:40 | 显示全部楼层
*m_temp=*s_temp;不要*
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行