On Wed, Aug 11, 2010 at 22:48, anup <anup007s...@gmail.com> wrote:
> Hi I am impkementing protobuffers in my Symbian application and during
> parsing I am sending a file to the proto parser but when I am
> collecting my attributes its giving garbage values along with the real
> data. I  dont know what may be the problem. Here are the functions
> which I used
>
> com::sidebar::protobuf::Executions* ie2;
> std::ifstream myfile;
>
> myfile.open ("C:\\data\\file", std::ios::in);
>
> ie2->ParseFromIstream(&myfile);
>
> if (execution.has_title())

Here you use execution, before you had ie2 as a pointer. You should
make sure that the examples you give are actually compiling, otherwise
it is really hard to figure out what the actual problem is.

> {
>
> const ::std::string &titlevalue = execution.title();
>
> TPtrC8 ptr1(reinterpret_cast<const TUint8*> (&titlevalue));

Looks like you want to access the string of the titlevalue. That is a
std::string, so you can't just cast that to a char*; you might want to
access the content of the stringt with titlevalue.c_str(), which
returns the nul-terminated string you seem to look for (
http://www.sgi.com/tech/stl/basic_string.html )


>
> iprotobuf.buffer_title.Copy(ptr1);
>
>
> I have attributes like content_type, title, artist,singer... but when
> i am collecting these informations after parsing I am getting garbage
> values when i debugged the code i checked the memory locations.I dont
> know why is these happening.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to 
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to