小编use*_*427的帖子

"<<"(双尖括号)在C/C++枚举中意味着什么?

enum ofp10_port_state {

    OFPPS10_STP_LISTEN  = 0 << 8, /* Not learning or relaying frames. */
    OFPPS10_STP_LEARN   = 1 << 8, /* Learning but not relaying frames. */
    OFPPS10_STP_FORWARD = 2 << 8, /* Learning and relaying frames. */
    OFPPS10_STP_BLOCK   = 3 << 8, /* Not part of spanning tree. */
    OFPPS10_STP_MASK    = 3 << 8  /* Bit mask for OFPPS10_STP_* values. */

};
Run Code Online (Sandbox Code Playgroud)

c c++

4
推荐指数
2
解决办法
8513
查看次数

在shell脚本中使用curl来替换变量

嗨我想在shell脚本中使用curl,如下所示,但我无法替换CURL中的变量$ line.请建议

while read line
do
    echo "allowing mac $line"
    curl -X POST -d '{"src-mac": "$line"}' http://localhost:8080/wm/firewall/rules/json
    curl -X POST -d '{"dst-mac": "$line"}' http://localhost:8080/wm/firewall/rules/json
done < /home/floodlight/allowedmacs
Run Code Online (Sandbox Code Playgroud)

shell curl

3
推荐指数
1
解决办法
2043
查看次数

如何使函数在c ++中返回结构指针

我想让函数返回特定节点的地址.但是编译器没有检测到我创建的节点数据类型结构.

struct node
{
int data;

node *link;
};

node *header,*current;
node traverse(int pos);


node *Linkedlist::traverse(int pos)
{
    int location = 0;  
    current->link = header->link;
    node *address = new node;
    address->data = NULL;
    address->link = NULL;


    while(current->link != NULL)
    {

        if(location == pos)
        {
            cout <<current->link->data <<" "<< endl; 
            address->link=current->link;
        }
        location ++;
        current->link = current->link->link;

    }


    return  address->link;
}
Run Code Online (Sandbox Code Playgroud)

c++

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

标签 统计

c++ ×2

c ×1

curl ×1

shell ×1