On Mon, Jun 18, 2001 at 02:36:04PM +0300, Peter A. Volchek wrote:
> > Hi!
> >
> > I'm trying to parse the value of a Node by using this piece
> > of code:
> >
> > char *value;
> > value = attr.getNodeValue().transcode();
> > switch (value) {
> > case "John":
> > printf("Your name is John\n");
> > break;
> > case "Tom":
> > printf("Hello, Tom!\n");
> > break;
> > }
> >
> > But I get this error:
> > <<error C2450: switch expression of type 'char *' is illegal
> > Integral expression required >>
> >
> > Anybody could suggest an alternative to get the 'value'?
>
>
> char *value;
> value = attr.getNodeValue().transcode();
> printf("Your name is %s\n", value);
>
> :)
switch ()
expects an integral (bool, enum, int, ...) type not an array.
what about this:
std::string value(attr.getNodeValue().transcode());
if ("John" == value)
printf("Your name is John\n");
else if ("Tom" == value)
printf("Hello, Tom!\n");
else
abort();
--
Miroslaw Dobrzanski-Neumann
MOSAIC SOFTWARE AG
Base Development and Research
Tel +49-2225-882-291
Fax +49-2225-882-201
E-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]