编程语言
首页 > 编程语言> > c++中编码protobuf repeated string

c++中编码protobuf repeated string

作者:互联网

参考:http://www.cppblog.com/API/archive/2014/12/09/209070.aspx

proto文件

message group_s {
    repeated string       member_name = 1;
    string                group_name = 2;
}

C++程序

int main(int argc, char* argv[])
{
    group_s *group = new group_s;

    for(int j =0; j<3; j++){  
       std::string m_name = "MEMBER";
       group->add_member_name(m_name);
       std::cout<< group->member_name(j);
    }
    group->set_group_name("GROUP");
    return 0;            
}

标签:group,protobuf,int,c++,member,repeated,string,name
来源: https://www.cnblogs.com/abc36725612/p/14191675.html