编程论坛's Archiver

lingluoz 发表于 2008-6-20 14:43

用过code::block的人进一下关于strchr()

#include <stdio.h>


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

明明对的代码为什么用code::block编译的时候会p=strchr("ffffffsddd",'s');这行爆出一个warning啊 。。
郁闷中。。。

卖菜的鸟 发表于 2008-6-20 14:46

字符串和字符 ![tk05]

lingluoz 发表于 2008-6-20 14:50

前面是字符串 后面是字符啊。。

StarWing83 发表于 2008-6-20 15:02

不止是warning吧?应该还有一个error。
原因很简单。就是你没有包含string.h头文件。strXXX之类的函数都在这个头文件里面~~~~

StarWing83 发表于 2008-6-20 15:02

当然如果你是*.c文件编译的,那么就只有一个warning,告诉你strchr这个函数的声明不全……

VxWorks 发表于 2008-6-20 15:05

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.

StarWing83 发表于 2008-6-20 15:11

我说……LS在抄MSDN之前,能不能麻烦先仔细看看别人的程序……

VxWorks 发表于 2008-6-20 15:18

1. lz不会用strchr函数,所以给他贴文档。
2. 这是man的手册页,我没有用M$的系统,更不会用它的MSDN。

StarWing83 发表于 2008-6-20 15:39

1 lz明显会用strchr函数。只是不知道这个函数在哪个头文件里面而已。
2 man的手册页?Linux?教一下~~~对了,我的Ubuntu用pppoe上网好慢的,比Vista慢多了(一台机器,双系统),能帮忙看看么?有没有相应的文档可查呢?

lingluoz 发表于 2008-6-20 15:51

失误了。。

VxWorks 发表于 2008-6-20 16:03

1. 不知道一个函数的原型定义在哪个文件也叫会用这个函数?我认为把上面man文档的内容全掌握了才可能叫会用。SYNOPSIS段的第一句话是什么?
2.Unix类系统都有man。linux在网络上的性能不会比windows慢,特别是处理多线程网络服务时。不过你用ubuntu就难说了,听说Debian + bugs = ubuntu
或许是你的pppoe软件的问题,用apt先update一下试试。

StarWing83 发表于 2008-6-20 16:06

我没说性能啊……我还是怀疑是配置的问题……问题是根本就不会配置pppoe,那个pppoeconf都没给几个选项的,看options又看不懂……555……太失败了……
Vx推荐一个软件?
对了,Vx的操作系统是啥?
还有,“能用”和“会用”和“精通”好像不是一个概念吧?

lingluoz 发表于 2008-6-20 16:11

Solaris有人用过吗。。。[img]http://p.blog.csdn.net/images/p_blog_csdn_net/tonywjd/271596/o_Qemu-OpenSolaris_2007_06_10.png[/img]

StarWing83 发表于 2008-6-20 16:13

Solaris?sun的产品?免费否?

lingluoz 发表于 2008-6-20 16:22

sun产品 免费 不开源

StarWing83 发表于 2008-6-20 16:29

免费不开源……

VxWorks 发表于 2008-6-20 16:44

solaris快开源了,http://cn.sun.com/software/solaris/get.jsp
开源版叫OpenSolaris

自己桌面还是用linux吧,选redhat或suse,看CU的下载排行榜可以说明问题:

        红旗 Linux              168199
        SUSE Linux Ente..        62262
        Red Hat Enterpr..        53088
        SUSE Linux Ente..        41807
        fedora 8                21547
        Magic Linux                9447
        OpenSolaris 200..        7798
        Fedora Core 6               7227
        Ubuntu 8.04 LTS..        7043

让计算机外行用ubuntu,redflag去吧。
配置pppoe应该很简单的,和windows下一样,输入账号密码就OK了

StarWing83 发表于 2008-6-20 16:47

Ubuntu习惯了,不想换了……

StarWing83 发表于 2008-6-20 16:47

CU是啥?

mqh21364 发表于 2008-6-20 16:59

不会是你的单引号错了吧??

反正你贴的那个明显不对。

页: [1] 2

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.