--- In [email protected], Sanil P S <[EMAIL PROTECTED]> wrote: > > Hi All, > > I am writing a parser for incoming packets > of a protocol. The fields are interpreted > binary. ie; 4 bytes for an int,character single byte, > string values/text > values are parsed until end of string is reached > and so on. > > I used a char* and allocated the incoming size > dynamically, for receiving the incoming packet. > Parsed the byte array using string methods. > I tried using some byte array implementations > like QByteArray of Qt. But it is working just > like a string implementation. taking '\0' > as end of the array. > > I need an implementation or method to parse the > binary incoming packets and interpret them to > values. > > Please help me with any suggestions. At least > pointers to which byte array implementations I should > use or .. how to parse and interpret char* arrays > in a binary way.
The trouble with char* in your case is that it's designed to work with NUL terminated strings and nothing else. If you want to use those functions on something else, you will have to write your own libraries and/or functions. That's it. However, MY main problem is that I am not quite sure that I really understand what you mean. Could you please provide some easy example? Regards, Nico
