Re: [cpp] 怎么高效实现从char[] 到byte的转换?
li guojian
guojianlee at gmail.com
Tue Mar 20 21:04:50 CST 2007
1。 if(c == "")
字符串不能这样比较 要用strcmp
2。 写个函数
int getHashCode(const char *);
然后用switch....case:;
On 3/20/07, Fei Xu <flyingxu at gmail.com> wrote:
> 比如有这样的一个表:
> mov 01
> add 02
> div 03
> ...
> end 99
>
> 现在要根据传入的char*(也就是"move""add"之类)得到对应的数字 01, 02
>
> 简单的说当然就是
> if(c == "")
> ...;
> else if(c == "")
> ....;
>
> 但是这样写起来很麻烦,执行起来似乎效率也不高,有好办法吗?
>
> --
> Visual C++ Related Topics
> http://www.codediscuss.com
>
> _______________________________________________
> Cpp mailing list
> Cpp at codingnow.com
> http://codingnow.com/mailman/listinfo/cpp
>
More information about the Cpp
mailing list