| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2174 人关注过本帖
标题:用过code::block的人进一下关于strchr()
只看楼主 加入收藏
lingluoz
Rank: 2
来 自:苏州科技学院
等 级:新手上路
威 望:4
帖 子:749
专家分:0
注 册:2008-2-2
结帖率:100%
收藏
 问题点数:0 回复次数:24 
用过code::block的人进一下关于strchr()
#include <stdio.h>


int main()
{
    char *p;
    p=strchr("ffffffsddd",'s');
    return 0;
}

明明对的代码为什么用code::block编译的时候会p=strchr("ffffffsddd",'s');这行爆出一个warning啊 。。
郁闷中。。。
搜索更多相关主题的帖子: block strchr code 
2008-06-20 14:43
卖菜的鸟
Rank: 1
等 级:新手上路
帖 子:43
专家分:0
注 册:2008-6-18
收藏
得分:0 
字符串和字符 !
2008-06-20 14:46
lingluoz
Rank: 2
来 自:苏州科技学院
等 级:新手上路
威 望:4
帖 子:749
专家分:0
注 册:2008-2-2
收藏
得分:0 
前面是字符串 后面是字符啊。。

Murphy's Law :
If there are two or more ways to do something, and one of those ways can result in a catastrophe, then someone will do it.
2008-06-20 14:50
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
不止是warning吧?应该还有一个error。
原因很简单。就是你没有包含string.h头文件。strXXX之类的函数都在这个头文件里面~~~~

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-06-20 15:02
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
当然如果你是*.c文件编译的,那么就只有一个warning,告诉你strchr这个函数的声明不全……

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-06-20 15:02
VxWorks
Rank: 3Rank: 3
来 自:WindRiver
等 级:论坛游民
威 望:6
帖 子:859
专家分:68
注 册:2007-11-24
收藏
得分:0 
NAME
       strchr, strrchr, strchrnul - locate character in string

SYNOPSIS
       #include <string.h>

       char *strchr(const char *s, int c);

       char *strrchr(const char *s, int c);

       #define _GNU_SOURCE
       #include <string.h>

       char *strchrnul(const char *s, int c);

DESCRIPTION
       The  strchr() function returns a pointer to the first occurrence of the
       character c in the string s.

       The strrchr() function returns a pointer to the last occurrence of  the
       character c in the string s.

       The strchrnul() function is like strchr() except that if c is not found
       in s, then it returns a pointer to the null  byte  at  the  end  of  s,
       rather than NULL.

       Here "character" means "byte"; these functions do not work with wide or
       multi-byte characters.

RETURN VALUE
       The strchr() and strrchr() functions return a pointer  to  the  matched
       character or NULL if the character is not found.

       The strchrnul() function returns a pointer to the matched character, or
       a pointer to the null byte at the end of s (i.e., s+strlen(s))  if  the
       character is not found.

为了防止世界被破坏,为了守护世界的和平,贯彻爱与真实的邪恶,可爱又迷人的反派角色,VxWorks!
Don't ask me any question.I'm just here to buy soy sauce.
2008-06-20 15:05
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
我说……LS在抄MSDN之前,能不能麻烦先仔细看看别人的程序……

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-06-20 15:11
VxWorks
Rank: 3Rank: 3
来 自:WindRiver
等 级:论坛游民
威 望:6
帖 子:859
专家分:68
注 册:2007-11-24
收藏
得分:0 
1. lz不会用strchr函数,所以给他贴文档。
2. 这是man的手册页,我没有用M$的系统,更不会用它的MSDN。

为了防止世界被破坏,为了守护世界的和平,贯彻爱与真实的邪恶,可爱又迷人的反派角色,VxWorks!
Don't ask me any question.I'm just here to buy soy sauce.
2008-06-20 15:18
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
1 lz明显会用strchr函数。只是不知道这个函数在哪个头文件里面而已。
2 man的手册页?Linux?教一下~~~对了,我的Ubuntu用pppoe上网好慢的,比Vista慢多了(一台机器,双系统),能帮忙看看么?有没有相应的文档可查呢?

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-06-20 15:39
lingluoz
Rank: 2
来 自:苏州科技学院
等 级:新手上路
威 望:4
帖 子:749
专家分:0
注 册:2008-2-2
收藏
得分:0 
失误了。。

Murphy's Law :
If there are two or more ways to do something, and one of those ways can result in a catastrophe, then someone will do it.
2008-06-20 15:51
快速回复:用过code::block的人进一下关于strchr()
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013595 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved