| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 680 人关注过本帖
标题:MFC ListBox显示乱码,求助
只看楼主 加入收藏
lssaint
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-10-16
收藏
 问题点数:0 回复次数:0 
MFC ListBox显示乱码,求助
这是以先代码;
Cstring DevList;
void ICWinPcap::GetDevList()
{
    pcap_if_t *alldevs;
    pcap_if_t *d;
    int i=0;
    char errbuf[PCAP_ERRBUF_SIZE];
   
    /* Retrieve the device list from the local machine */
    if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL /* auth is not needed */, &alldevs, errbuf) == -1)
    {
       // fprintf(stderr,"", );
        DevList.Empty();
        DevList.Format(_T("Error in pcap_findalldevs_ex: %s"),errbuf);
        CDlg->m_DevList.InsertString(-1,DevList);//m_DevList是listbox控件。
        exit(1);
    }
   
    /* Print the list */
    for(d= alldevs; d != NULL; d= d->next)
    {
        //printf("%d. %s", ++i, d->name);
        DevList.Empty();
        DevList.AppendFormat(_T("%d、 %s\n"), ++i, (d->name));
        CDlg->m_DevList.InsertString(-1,DevList);
        //CDlg->m_IP.set
        DevList.Empty();
       if (d->description)
           DevList.AppendFormat(_T("(%s)\n"), d->description);
        else
            DevList.AppendFormat(_T("(No description available)\n"));
       CDlg->m_DevList.InsertString(-1,DevList);
    }
   
    if (i == 0)
    {
       // printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
        return;
    }

    /* We don't need any more the device list. Free it */
    pcap_freealldevs(alldevs);
}
搜索更多相关主题的帖子: machine local void needed 
2012-10-16 19:23
快速回复:MFC ListBox显示乱码,求助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014331 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved