The following code produces the compilation error, invalid conversion from 'const char*' to 'char*'. Both ptrInputFileName and ptrFileName are both declared as const char*. Any suggestions on how to get this to compile? Thank you.
TextInputBuffer::TextInputBuffer(const char *ptrInputFileName)
: ptrFileName(new char[strlen(ptrInputFileName) + 1])
{
//--Copy the file name.
std::strcpy(ptrFileName, ptrInputFileName);
strcpytakes the the destination as non-const pointerchar*andptrFileNameisconst char*. No implicit conversion possible and I wouldn’t recommend an explicit conversion. Just makeptrFileNamenon-const.