小编pdk*_*pdk的帖子

C++ cout十六进制格式

我是ac编码器,是c ++的新手.

我尝试用奇怪的输出cout打印以下内容.对此行为的任何评论表示赞赏.

#include<iostream>
using namespace std;

int main()
{
        unsigned char x = 0xff;

        cout << "Value of x  " << hex<<x<<"  hexadecimal"<<endl;

        printf(" Value of x %x by printf", x);
}
Run Code Online (Sandbox Code Playgroud)

输出:

 Value of x  ÿ  hexadecimal
 Value of x ff by printf
Run Code Online (Sandbox Code Playgroud)

c++

17
推荐指数
2
解决办法
3万
查看次数

IPv6链路本地地址格式

我正在开展一个与网络/压缩相关的项目.其中一台机器是Windows Vista,已经配置了IPv6.

当我尝试时ipconfig,我会看到以下格式的地址:fe80::9dc8:72fa:aacd:76e2%10

但是当我尝试从另一台机器ping这台机器时ping fe80::9dc8:72fa:aacd:76e2%10,我收到以下错误:

Ping request could not find host fe80::9dc8:72fa:e327:76e2%10.
Please check the name and try again.

任何想法/评论都非常有帮助.

windows networking tcp ping ipv6

14
推荐指数
2
解决办法
2万
查看次数

比较两个Wireshark捕获文件

我想使用iperf发送一些数据包并在客户端接收相同的数据包(可能已经通过不同的OSI层处理).我想检查发送的数据包是否与收到的数据包相同.

  1. 我可以使用Wireshark捕获流吗?
  2. 有没有办法将它们与wireshark进行比较?

或者还有其他更好的方法吗?

ip network-protocols

10
推荐指数
2
解决办法
1万
查看次数

如何让构造函数在两者之间返回?

我的意思是这样的

#include <iostream>

    using namespace std;

    class A{
            int a, b;

            public:
            A(int a,int b, int *c);
    };

    A::A(int x, int y, int *errcode)
    {
            *errcode = 0;
            a=x;
            b=y;

            // check for some error conditions
            // and return from the constructor
            if (y==0)
            {
              *errcode=-1;
              return;
            }

            // some more operations

            return;
    }

    int main() {

            int errorcode;

            A(1,0,&errorcode);

            cout << errorcode;

            return 0;
    }
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
1183
查看次数

标签 统计

c++ ×2

ip ×1

ipv6 ×1

network-protocols ×1

networking ×1

ping ×1

tcp ×1

windows ×1