On Monday, 22 January 2018 12:14:21 GMT Ralph Corderoy wrote: > > I didn't spot this yesterday, but that won't work because p is used as > > a variable within that function. > > Have you tried it? :-) > > int GetDValue(const char *k) > { > char *p = strrchr((char *)k, 'D'); > ... > p++; > > Yes, I read that before making the suggestion. > `const char *p' means p is a pointer to a char that's const. > It doesn't mean it's a const pointer to a char that can vary, > nor that it's a const pointer to a const char. > The pointer and char can be const or not, giving four variations. > Thus the `p++' should be fine; it's moving the pointer onto the next > const char.
Right thanks. I did say my knowledge of C / C++ is 'Janet and John', but I suspect that I never even made that grade ! -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2018-02-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR