[muscle] Re: retreiving data from a message

  • From: Jeremy Friesner <jaf@xxxxxxxxxxxx>
  • To: muscle@xxxxxxxxxxxxx
  • Date: Tue, 7 Jun 2005 13:30:32 -0700

Hi Wim,

Do it like this:

MessageFieldNameIterator iter = myMessage.GetFieldNameIterator();
String nextFieldName;
while(iter.GetNextFieldName(nextFieldName) == B_NO_ERROR)
{
   printf("The next field name in the message is [%s]\n", nextFieldName());
}

Also, if you are only interested in looking at fields of a certain type, you 
can specify that type in the GetFieldNameIterator() call (e.g. iter = 
myMessage.GetFieldNameIterator(B_STRING_TYPE)).

If you want to determine the type of a field and you know its name, use the 
Message::GetInfo() method.  It can also tell you how many items are present 
in that field.

-Jeremy

On Tuesday 07 June 2005 13:26, VANHERP Wim wrote:
> Hi,
>
> If i receive a message , how do i extract the fieldnames in the message
> ? =20
> When i look at the functions i only find functions where you have to
> know the fieldname.  How do i find wich fieldnames are used in the
> message ?
>
> regards
>
>
>
> -----Oorspronkelijk bericht-----
> Van: muscle-bounce@xxxxxxxxxxxxx [mailto:muscle-bounce@xxxxxxxxxxxxx]
> Namens Jeremy Friesner
> Verzonden: dinsdag 31 mei 2005 18:03
> Aan: muscle@xxxxxxxxxxxxx
> Onderwerp: [muscle] Re: retreiving data from a message=20
>
> > Can you give me a hint of how to retreive the data from a received=20
> > message =3D3F  I can find in the examples how to add a string to a=20
> > message but not how to retreive the data from it.
>
> Use the Find*() methods, e.g.
>
> String myString;
> if (msg.FindString("myfieldname", myString) =3D3D=3D3D B=3D5FNO=3D5FERROR=
> )
> printf("String was [%s]\n", myString());
>
> -Jeremy
>
>
>
> *** Disclaimer ***
>
> Deze e-mail, met eventuele bijlagen, is alleen bestemd voor de persoon of=
>  organisatie aan wie hij gericht is en, in voorkomend geval, alleen voor =
> het daarin opgegeven doel of gebruik. Hij kan vertrouwelijke informatie b=
> evatten en/of persoonlijke standpunten die niet noodzakelijk met die van =
> de VRT stroken. Elk gebruik van deze informatie (zoals bewerken, doorstur=
> en, geheel of gedeeltelijk reproduceren of verspreiden in welke vorm ook)=
>  door anderen dan de geadresseerde, is verboden. Hebt U deze e-mail per v=
> ergissing ontvangen, meld dat dan a.u.b. aan de VRT en wis de e-mail.
> =20

Other related posts: