Re: Very odd programming trouble

2001-08-07 Thread J.A.Serralheiro
I forgot, I was not trying to use this. Its seems to me very unsual. I was just checking that what was stated on the book and learned anew thing. regards J.A.Serralheiro

Re: Very odd programming trouble

2001-08-07 Thread J.A.Serralheiro
actually im reading "Software engineering in c" by peter darnell. its pretty basic. It was because I was reading this that this problem arised. Thanks every one for the detailed explanation.

Re: Very odd programming trouble

2001-08-07 Thread Eric G. Miller
You need to allocate memory for the destination. strcpy just copies bytes from one location to another -- *both* must be valid memory locations and may not overlap (undefined behavior). Go to comp.lang.c *and* read the FAQ. -- Eric G. Miller

Re: Very odd programming trouble

2001-08-07 Thread Gary Hennigan
"J.A.Serralheiro" <[EMAIL PROTECTED]> writes: > /*Hi folks. Heres a very odd trouble ( for me at least) > I was reading a book where it was stated that > " char *ptr = "text"; " is an allowed declaration and that > the compiler automatically allocates space for the string text and for th

Re: Very odd programming trouble

2001-08-07 Thread Dimitri Maziuk
* J.A.Serralheiro ([EMAIL PROTECTED]) spake thusly: [ char * non-writable ] RTFFAQ, or e.g. Thinking in C++. Or do 'man gcc' and search for -fwritable-strings flag. Explanation: by default gcc places character array literals into read-only memory. Attempt to write to that memory causes segfault.

Re: Very odd programming trouble

2001-08-07 Thread Erdmut Pfeifer
On Tue, Aug 07, 2001 at 03:20:52PM +0100, J.A.Serralheiro wrote: > /*Hi folks. Heres a very odd trouble ( for me at least) > I was reading a book where it was stated that > " char *ptr = "text"; " is an allowed declaration and that > the compiler automatically allocates space for the str