This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

converting object to char*

I'm writing in c++ and I'm trying to convert the object data into a char*. so I could write it into a file. 

I used the following code for it 

static_cast<unsigned char*>(object)

however I get for following error: Embedded C++ does not support the new cast syntax

How can I get around the issue and get the object data?

Thanks

  • What object are you working with? Is it a pointer or a structure. If it is a structure, you need to cast the address of the object, not the object.

    Also, what compiler (and version) are you using? And what device is this for?
     
    Todd

  • You can simply use c-style casts, I.e. (unsigned char*)&object. (I added the address-of operator, your description sounds as if it ought to be there). Embedded C++ is a bit weird. Here, it forces you to use c-style casts when the C++-variant is safer, easier to grep, and has zero overhead.