I am working on Legacy code where a string literal is assigned to a variable of type PTCHAR
(pointer to char) which is defined in the header: typedef WCHAR TCHAR, *PTCHAR;
PTCHAR str;
str = _tcsrchr(dir, '\\');
*(str++)=0;
str = TEXT("This is stackoverflow");
I am getting a warning 'conversion from a string literal to pointer-to-character (non-const) is deprecated',
I understand warning is coming because a const is assigned to a non-const pointer variable, but I can't make str CONST(LPCSTR) because it is being modified in code as *(str++)=0;
Is there a way to solve this?