RT,谢谢

解决方案 »

  1.   

    char szBuf[] = "100";
    int  i = atoi(szBuf);
      

  2.   

    atoi()就可以,前边的‘不用管的
      

  3.   

    我也正想问这个问题,找了半天没找到,还以为C++里没有这种函数呢.
    又恢复了对VC的信心....^_^
      

  4.   

    strtoul
    是你发明的吧。转长整型用atol
    浮点用atof
      

  5.   

    自己的code
    char c100="100";
    int i100=0;
    int index=0;
    while(*(c100+index)!=0)
    {
         i100=i100*10+(*(c100+index)-0x30);
         index++;
    }
      

  6.   

    要用标准的C++,把习惯改过来。
    #include <string>
    #include <iostream>
    #include <sstream>
    using namespace std;int main(int argc, char* argv[])
    {
      istringstream is("100");
      int value = 0;
      is >> value;
      cout << value << endl;
      return 0;
    }TO  femalelover(女人越追越远) atoi 是C运行库函数。VC是IDE环境。不是什么语言。
      

  7.   

    char szBuf[] = "100";
    int  i = atoi(szBuf);
      

  8.   

    建议用Anikan(皮皮鱼) 的方法,它的方法在VC里面最有效...而用其它的方法比如:atoi如果有溢出则是随机数;而istringstream 如有溢出则返回0.