I have following classes

message StudentInfo {
required int32 id = 1;
required string name = 2;
required string class = 3;
optional string age = 4;
}

message StudentList{
repeated StudentInfo studentInfo = 1;
}

and i wrote StudentList Google Protocol buffer as given below 

 StudentList List;
    for( int nIdx = 0; nIdx < 10; ++nIdx )
    {
        ++m_nIndex;
        string sIndex = NumberToString( m_nIndex);
        string sName = "Name - " + sIndex;

       StudentInfo* stuInfo = List.add_studentinfo();
       stuInfo->set_id( nIdx );
       stuInfo->set_age( sIndex);
       stuInfo->set_class_( sIndex );
       stuInfo->set_name( sName);
    }

    std::fstream output( "c:\\myData.bin" , ios::app |ios::out | 
ios::binary );
    if (!List.SerializeToOstream(&output)) 
    {       
        //OutputDebugString( _T("Failed writing SPS"));
        return;
    }
    output.close();

How to modify or delete a particular StudentInfo in this buffer??

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to