谢谢了哈!!!!哪个能告诉我嘛!!!我太急着做题了..谢谢!!!
-
近期文章
近期评论
- coolker 发表在《打造最快的Hash表》
- struggle 发表在《提供C语言教学课件(适用于初学者)》
- zhanghaibo 发表在《提供C语言教学课件(适用于初学者)》
- zhanghaibo 发表在《提供C语言教学课件(适用于初学者)》
- diys 发表在《C语言编程宝典(王大刚) 1.1 C 语言的产生与发展》
文章归档
- 2022 年十月
- 2014 年一月
- 2013 年十二月
- 2012 年十一月
- 2012 年七月
- 2012 年六月
- 2012 年五月
- 2012 年四月
- 2012 年三月
- 2012 年二月
- 2011 年十二月
- 2011 年十月
- 2011 年九月
- 2011 年八月
- 2011 年七月
- 2011 年六月
- 2011 年五月
- 2011 年四月
- 2011 年三月
- 2011 年二月
- 2011 年一月
- 2010 年十二月
- 2010 年十一月
- 2010 年十月
- 2010 年九月
- 2010 年八月
- 2010 年七月
- 2010 年六月
- 2010 年五月
- 2010 年四月
- 2010 年三月
- 2010 年二月
- 2010 年一月
- 2009 年十二月
- 2009 年十一月
- 2009 年十月
- 2009 年九月
- 2009 年八月
- 2009 年七月
- 2009 年六月
- 2009 年五月
- 2009 年四月
- 2009 年三月
- 2009 年二月
- 2009 年一月
- 2008 年十二月
- 2008 年十一月
- 2008 年十月
- 2008 年九月
- 2008 年八月
- 2008 年七月
- 2008 年六月
- 2008 年五月
- 2008 年四月
- 2008 年三月
- 2008 年二月
- 2008 年一月
- 2007 年十二月
- 2007 年十一月
- 2007 年十月
- 2007 年九月
- 2007 年八月
- 2007 年七月
- 2007 年六月
- 2007 年三月
- 2007 年二月
- 2007 年一月
- 2006 年十二月
- 2006 年十一月
- 2006 年十月
- 2006 年九月
- 2006 年八月
- 2006 年七月
- 2006 年六月
- 2006 年五月
- 2006 年四月
- 2006 年三月
- 2006 年二月
- 2006 年一月
- 2005 年十二月
- 2005 年十一月
分类目录
功能
用strlen(str)就行了。。返回值就是长度。
谢谢了哈..
太感谢了..我去试一下…如有问题再来问你们..呵呵..
第十章Dlg.cpp
G:\vc\第十章\第十章Dlg.cpp(195) : error C2440: ‘=’ : cannot convert from ‘void’ to ‘char’
Expressions of type void cannot be converted to other types
G:\vc\第十章\第十章Dlg.cpp(196) : error C2065: ‘a’ : undeclared identifier
G:\vc\第十章\第十章Dlg.cpp(196) : error C2664: ‘strlen’ : cannot convert parameter 1 from ‘char’ to ‘const char *’
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
第十章.exe – 3 error(s), 0 warning(s)
能告诉我这是怎么回事吗?帮我改一下好吗?谢谢了哈我真的不懂了…我的原程序如下:
char st;
int a;
m_e1.SetSel(0,-1);
m_e1.Copy();
st=m_e2.Paste();
a=strlen(st);
m_e2.SetSel(0,-1);
m_e2.ReplaceSel(a);
char *st;
这样才对吧。你那样只是一个字符串。。
或是 char st[MAX_PATH]=”";
st=m_e2.Paste();
这个函数没有返回值呀。你调用错了,
strlen(str) 这个就ok 了 哦 试 试 看
刚才回错了,用sizeof()不行的,求的是字符额
楼主问的是vc怎么计算字符串长度吧
在c中,字符串是作为字符数组来处理的,字符串的字符是逐个存放到数组元素中的,以’\0′为结束符,而我们知道字符在内存中是分配两个字节的,由此就可以轻松地知道vc是怎么计算其长度的了,strlen(字符数组)函数可供我们来测试字符长度,它不包括’\0′在内
用函数strlen()就行。
用strlen()可以算出字符的长度
用sizeof()中以算出字符占用的空间