On Mon, Jun 01, 2009 at 10:53:13AM +0200, Raymond Wooninck wrote:
On Monday 01 June 2009 07:40:56 Martin Vidner wrote:
we have char *strchr(char *, int) const char *strchr(const char *, int)
I am not that well familiar with C++ and maybe an example would work better :
If I have the following statement
char *pp = strchr(str, ';');
(str is a const char), then this one fails with the above error. But would the following statement be the right correction :
const char *pp = strchr(str, ';');
That is right. Except for the case when you then modify the string through pp. (The compiler would give you another error) I actually had a case where I put a NUL byte at pp and then the original character back, so I used char *pp = (char *) strchr(str, ';'); See here for the actual code: http://svn.opensuse.org/viewvc/yast/trunk/core/libycp/src/StaticDeclaration.cc?annotate=57367&pathrev=57367#l276 -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org