Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Cannot convert 'const void *' to 'const char *' in C++
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 2nd October 15:09
External User
 
Posts: 1
Default Cannot convert 'const void *' to 'const char *' in C++


Hi,

I am using a API I downloaded from the internet programmed in C. I need
the function below which works with this api in my c++ file -

void StoreNoteCallback(void *context, int arglen, const void *args,
OSCTimeTag when,
NetworkReturnAddressPtr returnAddr)
{
const char *typeArgs = (const char *)args;
const float *floatArgs = &typeArgs[OSCPaddedStrlen(args)];
}

The problem is that the gives me the errors -

Cannot convert 'const void *' to 'const char *' in function
StoreNoteCallback
Type mismatch in parameter 's' (wanted 'const char *', got 'const void
*') in function StoreNoteCallback
Cannot convert 'const char *' to 'const float *' in function
StoreNoteCallbac

The above works in a c program. What's the problem and how do I fix it?

Thanks,

Barry.
  Reply With Quote


  sponsored links


2 9th October 19:30
frederick gotham
External User
 
Posts: 1
Default Cannot convert 'const void *' to 'const char *' in C++


void *pv = 0;

char *pc;

pc = static_cast<char*>(pv);

--

Frederick Gotham
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666