关于CString 的问题
程序是这样的:
#include "stdafx.h "
#include <afx.h>
#include "iostream "
#include "Wininet.h "
#pragma comment(lib, "Wininet.lib ")
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
DWORD dwFlags;
CString ConnectKind;
if(InternetGetConnectedState(&dwFlags,0))
{
cout < < "您已经接入internet,! " < < endl;
dwFlags = dwFlags&0x07;
if(dwFlags==INTERNET_CONNECTION_LAN)
{
ConnectKind = "本机通过局域网接到internet ";
cout < < "2 " < <endl;
}
if(dwFlags==INTERNET_CONNECTION_PROXY){
ConnectKind = "本机通过代理接到internet ";
cout < < "3 " < <endl;
}
cout < < ConnectKind.GetBuffer () < <endl;
}
else
{
cout < < "对不起,您还没有接入inernet,正在进行接入 " < <endl;
if(InternetAttemptConnect(0) == ERROR_SUCCESS)
cout < < "您接入了internet,祝你冲 " < <endl;
}
ConnectKind.ReleaseBuffer();
return 0;
}
为什么cout < < ConnectKind.GetBuffer () < <endl;
的输出是一32位的数字呀,不应该是文字吗?
[解决办法]
哎
所有使用VS2005的用户都要先在字符串编码类型这里过一过堂……
[解决办法]
你用的是Use Unicode Character Set
不使用Unicode的就可以了