我在VC环境下建立了一个WIN32的简单应用程序项目,然后在里头放置了如下对所输入的字符进行加密算法并显示加密结果,代码如下:
int main()
{
    MD5_CTX context;
    unsigned char digest[16];
    memset(digest,0,16);
    CString m;//错误:'CString' 以及'm': undeclared identifier
    int len;
    cin>>"请输入字符串";
    cin>>m;
    len=m.GetLength();//错误:left of '.GetLength' must have class/struct/union type
    MD5Init(&context);
    MD5Update (&context, (unsigned char*)m, len);
    MD5Final (digest, &context);
    cout<<"the result is\n";
    long old_options = cout.flags(ios::hex);
    for(int i =0;i<16;i++)
{
     cout<<(int)digest[i];
}
cout.flags(old_options);
return 0;
}
这该怎么解决

解决方案 »

  1.   

    我做了更改如下:
        char m[16];
        int len;
        cin>>"请输入字符串";
        cin>>m;
        len=sizeof(m);
    可以运行也可以写入字符串,但只要一回车(也就是要开始加密了)就弹出常见的错误框。
      

  2.   

    #include "stdafx.h"
    #include <iostream>
    #include <string>
    #include "md5.h"using namespace std ;int main()
    {
        MD5_CTX context;
        unsigned char digest[16];
        memset(digest,0,16);
    string m;
        int len;
        cout<<"请输入字符串";
        cin>>m;
        len=m.length();//错误:left of '.GetLength' must have class/struct/union type
        MD5Init(&context);
        MD5Update (&context, (unsigned char*)m.data(), len);
        MD5Final (digest, &context);
        cout<<"the result is\n";
        long old_options = cout.flags(ios::hex);
        for(int i =0;i<16;i++)
    {
         cout<<(int)digest[i];
    }
    cout.flags(old_options);
    return 0;
    }
      

  3.   

    谢谢楼上的 vcmute(横秋) 
    真是佩服你!现已解决!谢谢谢谢