J.A.Serralheiro writes:
 >   It seems that the compiler as some dificulties assigning *dest++ = *src++
 >   when dest is a char *ptr = "kljdflg". But when src is this kind

Yes, this will not work, because char* ptr should really be something
like char const* ptr.  That is, a pointer to a constant char, because
this is what it really is. "kljdflg" is not on the heap, but on some
static portion of memory somewhere, which you are not allowed to write 
to, but are trying to do with the strcpy.

Incidentally, you should always use strncpy, instead of strcpy.  You
can also use memcpy.

Andrew.

Reply via email to