I am very new to c++ and don't know all the rules quite yet. I am trying to fix this function by returning an int from a const char *. This is what it looks like:
int UARTwrite(const char *pcBuf, uint32_t ui32Len)
{
const char* p = pcBuf;
int i = 0;
for( i = 0; i < ui32Len; ++i )
{
printf( "%c", *p );
++p;
}
return(std::cout << p << ' ' << static_cast<int> (p)); // error: invalid static_cast from type 'const char*' to type 'int'
}
before there was no return, so I tried a static_cast which didn't work. I commented the error the keeps popping up. Any help is appreciated.