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;            
}
上一篇:MacOS下为golang配置Protobuf


下一篇:290,重复的DNA序列