1

I'm reading some data from a plist file in visual c++.

data in file is somethig like this:

Caminando_001.png x y width height offsetX offsetY originalWidth originalHeight

I read until x key value and then I do something like

int Left = boost::any_cast(iter->second); //iter is a pair std::string boost::any

That last line trows an exception (any bad cast) and I don't know what is the problem.

TemplateRex
  • 69,038
  • 19
  • 164
  • 304
Fabricio
  • 11
  • 1
  • You're missing the template parameters on boost::any_cast, is that a typo? Also, if there was a `` there, I think the value from the plist is a string, so any_cast will throw an exception, you should convert the string to int using some other method. – Luke B. Jul 16 '13 at 14:50
  • yes, it's int but when I post the question it doesn't show this part. What I do (when it trows an exception) is: int Left = boost::any_cast< int >(iter->second); //iter is a pair std::string boost::any – Fabricio Jul 16 '13 at 20:07
  • Can you any_cast it to string instead of int? – Luke B. Jul 16 '13 at 20:18

0 Answers0