char a[32] = "This is a string!";
或者
LPSTR b = "This is another string!";都可以~请大家知无不言,谢谢!

解决方案 »

  1.   

    char* str="This is a string!";
    char str[]="This is a string!";
    WCHAR *str=L"This is a string!";
    WCHAR str[]=L"This is a string!";
    CString str="This is a string!";
    string="This is a string!";
    _bstr_t="This is a string!";
    BSTR=::SysAllocString(L"This is a string!");
    其它的归根结蒂都是这些
      

  2.   

    后面三个有点错:)
    string str="This is a string!";
    _bstr_t str="This is a string!";
    BSTR str=::SysAllocString(L"This is a string!");
      

  3.   

    CString str
    string str
    char str[30]
    wchar_t str[30]
    char*
    basic_string<...> str
    TCHAR str[30]
    _bstr_t
    BSTR呵呵,有些和薄荷重复了!
      

  4.   

    用作函数参数呢?
    有人拿WCHAR作函数参数么?没怎么见过哦~
    好像一般都是:void foo(char * str1,LPSTR/LPTSTR str2,char str3[100],BSTR str4,LPCSTR/LPCTSTR str5)~
    最后两个只能传入,不能改~
    对不对?
    我对字符串最晕了!
      

  5.   

    完全同意vcforever(霓裳羽衣)的意见,尤其是最后一条鉴于这个贴子有点难度,加以楼猪考虑再加200分
      

  6.   

    WCHAR* 也可以传进来,就象char*,但是BSTR有更好的优点,就是BSTR前面的四个字节一般会存放BSTR的长度!(如果这个BSTR是通过SysAllocString得到的),这样子不用遍历就能知道字符串有多长了
      

  7.   

    就说这几种吧~char* str="This is a string!";
    char str[]="This is a string!";
    BSTR str=::SysAllocString(L"This is a string!");
    在内存中存在的形式~
    char* str里的str是一个指针~str所代表的地址是谁的地址?
    char str[]里的str呢?
    BSTR str里的str呢?